Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

target="_blank" link opening in PWA and not in browser in Android

I have a website which is also a PWA.

If I add the PWA to my device (Android) and then go back into the browser (Chrome, latest available version for Android), the links with target="_blank" will open in the PWA, no matter what.

I know this could be a corner case, but what if I want to be sure that browsers links will be open in browser and not in the PWA?

iOS behaves correctly...

like image 796
napolux Avatar asked Nov 06 '18 14:11

napolux


1 Answers

In manifest.json you set a scope, which determines which links will open in the PWA and which will open in the browser:

scope parameter in PWA Manifest

Edit: Explanation as well as examples are right on the page linked above.... But I can paste them here for you, if that helps?

The scope member is a string that defines the navigation scope of this web application's application context. It restricts what web pages can be viewed while the manifest is applied. If the user navigates outside the scope, it reverts to a normal web page inside a browser tab or window.
If the scope is a relative URL, the base URL will be the URL of the manifest.

Relative Scope: "scope": "/app/"
Limiting Scope to Domain: "scope": "https://example.com/"
Combining the above examples: "scope": "https://example.com/subdirectory/"

like image 51
DukeDrake Avatar answered Nov 14 '22 20:11

DukeDrake