Issue
I am opening window in my ionic app
await Browser.open({url: environment.apiUrl + `/myurl`});
But then I want to close close that window it self when user complete certain action. I tried window.close
but due to security issues it does not work.
How do I close that window?
Solution
Finally found the way.
- Register custom scheme
- In external app redirect
window.location.href="customschema://"
- For iOS listen for appUrlOpen and close browser, for android as soon as you redirect to custom schema will close.
Place into app.component on app start
if (this.platform.is('ios')) {
App.addListener('appUrlOpen', data => {
if (data.url.indexOf('comflymarkonline://')> -1) {
Browser.close();
}
});
}
Answered By - Vova Bilyachat
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.