Open external links in webview as default in IOS P

2019-04-09 00:03发布

问题:

I'm testing Progressive Web App in IOS 11.3.

My pwa has a Facebook social login button that, when clicked, points to external link (different windows.location).

The problem is that the pwa opens safari app to show external links instead of using a webview within the pwa so, when the login is done, you will not be redirected to pwa but remains in safari.

I tried following examples like this one https://gist.github.com/kylebarrow/1042026 but seems not working

How can i force the pwa to open external links in a webview?

Thanks in advance

回答1:

This problem is solved in IOS 11.4

UPDATE

@twhite96 @Marty121 The Google Social login worked well few times but now seems to be broken again :/ The offline support seems to be broken too! PWA on IOS sucks! I think we need to wait the next IOS release hoping that they will fix the long list of bugs



回答2:

Use BUTTON instead of A tag and set onclick with window.location.href = 'yourUrl' It seems to working well



回答3:

If you use SSR (Server Side Rendering) and your PWA is not static, you should follow App Shell concept. So every time when you click external link, it should be fetched and inserted in your dynamic section. Link: https://developers.google.com/web/updates/2015/11/app-shell