Reputation: 168
Is there a way to close the in app browser? window.close
is only working on iOS device, and it doesn't work in Android. I've tried using window.top.close
and window.open("","_self") window.close
and none of it is working. I've tried to look for which browser does Viber and Line use internally but they don't have any documentation
Upvotes: 1
Views: 1181
Reputation: 397
I am adding this just for future references. You can set window.location.href
to Viber deep link like viber://pa?chatURI=<URI>
to navigate back to chat window. Here is the doc page.
Upvotes: 0
Reputation: 1828
You can try this:
var win=window.open( "myurl", "_blank");
win.addEventListener( "loadstop", function(){
var loop = window.setInterval(function(){
win.executeScript({
code: "window.shouldClose"
},
function(values){
if(values[0]){
win.close();
window.clearInterval(loop);
}
}
);
},100);
});
In your called window, simply do this, When you want to close it
window.shouldClose=true
Upvotes: 1