How to get the url of currently opened tabs in all browsers with php or javascript?
If anyone can guide a bit or have little knowledge how to make it possible, pleas开发者_运维问答e let me know.
Thanks
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.
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.
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.
Separately: This information is certainly not sent server-side (you tagged your question php
).
if you are expecting to do it from a web page, then you cannot get that through any language executed on Serverside or Client Side.
If you asked in context for Firefox Addons, this might help ::
var tabs = require("tabs");
for each (var tab in tabs)
console.log(tab.url);
But this works only for Firefox Addons, not normal javascript.
Reference https://addons.mozilla.org/en-US/developers/docs/sdk/1.0/packages/addon-kit/docs/tabs.html
Hope this helps.
Actually there is a way, just bookmark all tabs and then drag the bookmark somewhere, for instance to a html form, and then you can use for instance javascript to read it from there. I don't know about other browsers yet, but in firefox you get the bookmark name, followed by all the urls, everything separated by newlines, no trailing newline at the end.
精彩评论