Reputation: 492
My background page saves data about the current active tab to chrome.storage.local
. For arguments sake lets say it's the page title. Multiple page titles will be in there if the user has multiple tabs open.
When the browser action button is clicked I want to open a new tab with my internal extension page showthedata.html
(not an external URL) which will show the data saved for the active tab.
Ideally I'd want to open showthedata.html?tabID=123
which would then pull the corresponding data
I must be missing something basic, but how can showthedata.html
show the data relating to the active tab?
Upvotes: 0
Views: 1369
Reputation: 1268
If you use your extension's URI as the URL of your new tab, it will allow you to use the API's messaging and storage systems from your new tab.
Create a New Tab
chrome.tabs.create({url: "chrome-extension://<your_extension_id>/path/to/file.html"})
Once you get that set up, you can pass variables to or request variables from your new tab via the Chrome API messaging system or storage system (provided you've built the proper functionality into your extension's various parts).
Note: The chrome.tabs namespace is not accessible from within a Chrome tab. It must be called from either your background script(s) or popup.
Upvotes: 3