我有一个问题,我创建了一个有角度的 PWA,我的应用程序使用 auth0-lock 作为其身份验证,现在我的问题是......例如,当您单击 Google 等单一登录选项之一时,您会被退出PWA 和 safari,有什么办法可以防止这种情况发生吗?
我试过把这段代码放在我的 index.html
<!-- Prevent app from opening new safari page -->
<script type="text/javascript">
(function(document,navigator,standalone) {
// prevents links from apps from oppening in mobile safari
// this javascript must be the first script in your <head>
if ((standalone in navigator) && navigator[standalone]) {
var curnode, location=document.location, stop=/^(a|html)$/i;
document.addEventListener('click', function(e) {
curnode=e.target;
while (!(stop).test(curnode.nodeName)) {
curnode=curnode.parentNode;
}
// Condidions to do this only on links to your own app
// if you want all links, use if('href' in curnode) instead.
if('href' in curnode && ( curnode.href.indexOf('http') || ~curnode.href.indexOf(location.host) ) ) {
e.preventDefault();
location.href = curnode.href;
}
},false);
}
})(document,window.navigator,'standalone');
</script>
但这似乎不起作用,我已经看到了其他一些可以防止这种情况发生的 javascript hack,但我还没有找到一个可以在我的 Angular 应用程序中使用的方法?
有人对这个有经验么??
谢谢