I am looking for a way to determine a given tab's opener (parent tab) within a Google Chrome extension.
I've looked at the documention for Tab but there doesn't really seem to be anything that would yield this information. http://code.google.com/chrome/extensions/tabs.html
I've tried injecting this content script into pages (thinking I could pass the value to my background page):
alert(window.opener);
.. but it just yields null.
The best thing I've come up with so far is to keep track of the currently focused tab, and whenever a new tab is created, just assume that the focused tab is the opener/parent of the new tab. I believe this would de facto identify the parent tab correctly most of the time since background tabs rarely (are allowed to) open new pages. However, it seems kludgey and potentially inaccurate at times -- for example, if another extension opened a new tab, this method may misidentify the new tab's opener.
Then when you hover (if you have Bluetooth mouse enabled) or tap the tab icon (with your finger) (the :D), it will tell you how many tabs you have open. Like on mine, it said 713 tabs open.
“Chrome extensions can be detected by fetching their web-accessible resources — the files inside an extension that web pages can access,” z0ccc explained. “The detected extensions can be used to track you through browser fingerprinting.”
Tab managers — also known as tab organizers or session managers — are only available as extensions or plugins for your Chrome browser. That's because Chrome doesn't have built-in tab organization, aside from tab groups (which you can read about here).
Update: it is now possible to reliably determine a tab's opener tab within a Chrome extension natively using the newly added webNavigation API, and specifically by hooking the onCreatedNavigationTarget event.
https://code.google.com/chrome/extensions/trunk/webNavigation.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With