如何使用 php 或 javascript 获取所有浏览器中当前打开的选项卡的 url?

2022-01-09 00:00:00 firefox browser tabs php javascript

如果有人可以指导一下或对如何使它成为可能知之甚少,请告诉我.

If anyone can guide a bit or have little knowledge how to make it possible, please let me know.

谢谢

推荐答案

您不能,此信息无法通过任何标准界面获得(除了您已经参考的窗口).你可以看到为什么.您不希望您的一个标签的网站所有者能够知道您所有其他标签的显示内容,这将大量侵犯您的隐私.

You can't, this information is just not available via any standard interface (except for a window you already have a reference to). You can see why. You wouldn't want the site owner for one of your tabs to be able to know what all your other tabs were showing, that would be a massive invasion of your privacy.

对于您已经引用的窗口,您可以获取该窗口正在显示的任何内容的 URL (window.location.href),也可能是其父窗口的 URL (window.parent.location.href)、顶级 (window.top.location.href) 和下级框架 (window.frames[n].location.href — 我想).但这不会让你得到你要求的标签.

For windows you already have a reference to, you can get the URL of whatever that window is showing (window.location.href), and possibly that of its parent window (window.parent.location.href), top-level (window.top.location.href), and subordinate frames (window.frames[n].location.href — I think). But that's not going to get you the tabs you asked for.

此信息可能通过各种浏览器的扩展机制(Firefox 插件、Chrome 扩展等)获得,但这仅适用于需要用户显式安装的浏览器扩展,并且(目前) 需要为每个浏览器供应商编写一个,并非所有供应商都提供扩展机制.

This information is likely available via the extension mechanism of various browsers (Firefox add-ins, Chrome Extensions, etc.), but that would be only for a browser extension, which requires an explicit install from the user, and (currently) requires writing one for each browser vendor, where not all vendors offer an extension mechanism.

另外:此信息肯定不会发送到服务器端(您标记了您的问题 php).

Separately: This information is certainly not sent server-side (you tagged your question php).

相关文章