Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Navigation is blocked' when opening 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.

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>

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?

like image 500
Bart Bergmans Avatar asked Aug 12 '16 11:08

Bart Bergmans


1 Answers

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!

like image 135
Bart Bergmans Avatar answered Oct 04 '22 15:10

Bart Bergmans