Open url in same tab in browser using android code(not using webview)

隐身守侯 提交于 2021-01-29 04:33:16

问题


I am trying to open URL in browser in same tab. Instead of creating new tab(for same URL) of each click on android app.

Hers's is the code:

Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://1.1.1.1:8008"));
intent.putExtra(Browser.EXTRA_APPLICATION_ID, "com.android.browser");
startActivity(intent);

If I close the browser and again restart the application I see URL opened in new tab, instead of open using existing tab.


回答1:


There are many Web browsers available for Android. Whether a browser even offers tabs to the user is up to the developers of the browser. For those that do offer tabs, how the browser handles ACTION_VIEW requests with respect to those tabs is also up to the developers of the browser.

There is nothing in the standard ACTION_VIEW protocol to say "please put this in an existing tab", largely because few things that support ACTION_VIEW have tabs.

It is certainly possible that some browsers offer some extra to control tab behavior with respect to ACTION_VIEW. You are welcome to contact the developers of those browsers and ask them.



来源:https://stackoverflow.com/questions/42249796/open-url-in-same-tab-in-browser-using-android-codenot-using-webview

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!