本文介绍了打开Intent时“导航被阻止"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为应用程序付款.用户在浏览器中付款后,必须将其重定向回该应用程序.

I am working on the payment process for an app. When the user has paid in the browser he has to get redirected back to the app.

我的解决方案是从浏览器中打开一个Intent.为此,我做了一个按钮,然后使用javascript单击了它:

My solution is to open an Intent from the browser. To achieve this I made a button and clicked it using javascript:

<body onload="document.getElementById('backToApp').click();">
    <a style="margin: 50px auto;" id="backToApp" class="btn btn-success" href="intent://app/#Intent;scheme={{ scheme }};package={{ package }};S.data={{ data }};end">Return to app</a>
</body>

唯一的问题是,当我在移动浏览器中打开网站时,Chrome调试器显示:Navigation is blocked.有办法解决这个问题吗?

The only problem is that when I open the site in my mobile browser the Chrome debugger says: Navigation is blocked. Is there a way to fix this?

推荐答案

我前一段时间发现了问题,在这里忘了提及,对不起!如果您已使用您的应用程序打开了此站点/会话,则只能以有意图的方式打开应用程序.因此,如果您通过输入URL进入浏览器中带有意图"按钮的页面.您将收到导航被阻止".如果您通过从应用重定向到该页面来打开页面,然后单击该按钮,它将起作用!

I found the problem a while ago, forgot to mention it here, sorry! You only can open an app with an intent if you have opened this site/session with your app.So if you go to the page with the intent button in your browser by typing the URL. You will get 'Navigation is blocked'.If you open the page by redirecting there from your app and you click the button, it works!

这篇关于打开Intent时“导航被阻止"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 22:37