简体   繁体   中英

Close a browser tab opened by Android app

I have an issue where I'm asking my app to open a browser looking at my Server.

From that server page, The user can perform some stuff on an existing site, then redirects the user to a URL that the App catches and the App continues as normal.

The lifecycle looks like this:

App -> Web Site -> App

However, after the life cycle of the app and the app is closed, the webpage is still open in the browser (on the page where the redirect to the app occurred).

It's apparently difficult via javascript to close a tab which wasn't opened by javascript? (In my case, the tab was opened by the app, not by a different tab). Is there any way to get around this?

(I'm aware I could use a WebView, but WebViews are buggy, manufacturer specific, security holes that I want to avoid)

No, sorry. There is no standard Intent structure for this. While it is possible that some browsers offer something, I am not aware of any that do.

Bear in mind that there is no requirement that your ACTION_VIEW Intent open up a browser tab, as the user's chosen browser may not offer any sort of tab UI metaphor. check this reference old question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM