使用Android代码在浏览器的同一选项卡中打开url(不使用webview) [英] Open url in same tab in browser using android code(not using webview)

查看:55
本文介绍了使用Android代码在浏览器的同一选项卡中打开url(不使用webview)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在同一选项卡的浏览器中打开URL.而不是为每次点击Android应用程序都创建新标签(针对相同的URL).

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.

她的是代码:

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);

如果我关闭浏览器并再次重新启动应用程序,则会看到URL在新选项卡中打开,而不是使用现有选项卡打开.

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

推荐答案

有许多可用于Android的Web浏览器.浏览器是否甚至向用户提供 选项卡,都取决于浏览器的开发人员.对于那些提供选项卡的浏览器,浏览器如何处理与这些选项卡有关的 ACTION_VIEW 请求也取决于浏览器的开发人员.

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.

标准的 ACTION_VIEW 协议中没有任何内容要说请把它放在现有标签中",这主要是因为很少有支持 ACTION_VIEW 的东西都带有标签.

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.

某些浏览器当然有可能针对 ACTION_VIEW 提供一些额外的功能来控制选项卡的行为.欢迎您与这些浏览器的开发人员联系并询问他们.

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.

这篇关于使用Android代码在浏览器的同一选项卡中打开url(不使用webview)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆