progressive-web-appswindow.openangular-pwa

PWA: prevent urls from opening in the PWA


I've built an angular app using @angular/pwa, that supports external logins like Microsoft, Google, Facebook and Twiitter. When a user wants to signin using an external login, I'm using window.open to open the url hosting the Challenge.

The problem is that when calling window.open from the web app in the browser, the url is being forced to open in the PWA.

I've litterally already tried everything I can to prevent this, but without success. The last thing I've tried was to host my endpoints for my external logins on a subdomain, which worked quite well.

But now I've implemented 2FA in my web app, and for 2FA to work, the ExternalLoginSigninAsync must be called from the same domain as the call to TwoFactorAuthenticatorSignInAsync. So how can I force an url (window.open) to open in the browser instead of the PWA?

PS: Don't come up with

  1. Exclude from navigationUrls ("navigationUrls": [ "!/web/v3/Account/connect/" ])
  2. window.open(url, '_system')
  3. window.open(url, '_blank')
  4. Use ngsw-bypass (window.open(url + '?ngsw-bypass=true'))

That's all been tried, and doesn't work.

Edit

This block of code appears to determine whether the PWA should be launched or a new tab should be opened.

Call stack:


Solution

  • 3 years on.

    Done waiting for a W3 draft.

    Did it like this

    Here's a demo

    Note that window.document.location.assign(...) is not the same as window.location = ...