DEV Community

Discussion on: How to handle outbound links in desktop PWA?

Collapse
 
niorad profile image
Antonio Radovcic

But isn't this exactly what you asked?

"If the user navigates outside the scope, it returns to a normal web page inside a browser tab/window."

So you define the scope in the manifest.json and shouldn't even need to add target="_blank" to links.

Thread Thread
 
terabytetiger profile image
Tyler V. (he/him) • Edited

Based on the information on developers.google.com/web/fundamen... it appears that you do need to add target="_blank"

"Caution: If the user clicks a link in your app that navigates outside of the scope, the link will open and render within the existing the PWA window. If you want the link to open in a browser tab, you must add target="_blank" to the <a> tag. On Android, links with target='_blank' will open in a Chrome Custom Tab."

I do see where the confusion came from on the MDN docs. Initially I read it the same way you did.

Thread Thread
 
ben profile image
Ben Halpern

Hmmm perhaps, but implementations may vary. It seems like it still opens another browser page within the app or something. I think it's possible that this detail is not part of the spec. In fact, I think iOS had a the "back to browser" behavior by default and then switch to "in-app browser".

Thread Thread
 
ben profile image
Ben Halpern

@ Tyler, awesome. That is the confirmation I was looking for and hadn't found. This makes it pretty clear what the current behavior is and that it is the expected behavior going forward.