This Content is from Stack Overflow. Question asked by uncommon_name
I open a new tab to show the user some info using:
<button class="btn btn-primary btn-block" onclick="window.close();"> return to home </button>
This method works well in Desktop and also when viewed through a standalone browser in Mobile, but when users navigate to the main page through embedded Web View in Instagram:
They cannot close the popup tab using the button. The button does nothing… and when they press back on their mobile phone, the main page is refreshed, and form input is lost.
I fixed it by detecting if the page is open in Instagram agent and redirected it to an external browser with the help of this question on SO:
Open link in External Browsers
This Question was asked in StackOverflow by uncommon_name and Answered by uncommon_name It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.