简体   繁体   English

从浏览器获取URL

[英]get URL from browser

Is possible with java know which pages web are open? Java是否可能知道打开了哪些页面?

Example: my tabs: 示例:我的标签:

facebook.com || facebook.com || stackoverflow.com/ ||google.com ||+|| stackoverflow.com/ || google.com || + ||

Example of what I want. 我想要的例子。

Output from java: 来自Java的输出:

Site: 

http://www.facebook.com

http://www.stackoverflow.com

http://www.google.com 

I can put the url in browser using this code: 我可以使用以下代码将网址放入浏览器中:

Desktop.getDesktop().browse(new URL("http://www.google.com").toURI());

But how I get? 但是我怎么得到的?

There is no standard Java API for this. 没有为此的标准Java API。 Also there is no standard API from the browsers' part to provide this info toward other applications. 同样,浏览器也没有标准的API可以向其他应用程序提供此信息。

So in short you can't do this. 简而言之,您无法执行此操作。 In case of some operating systems and in case of some browsers you might be able to get this by executing certain OS commands and parsing the output, but that is just hacky and won't work in all cases. 在某些操作系统和某些浏览器的情况下,您可能可以通过执行某些OS命令并解析输出来获取此信息,但这只是hacky,并非在所有情况下都有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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