My purpose is to capture the URL of the newest tab opened using a content script. I want to capture the URL of the new tab only if it was opened from a webpage which matches the pattern specified in the manifest.
My first though was to use this code in content_script.js, so it would be executed every time current page matches the pattern:
chrome.tabs.onCreated.addListener(function(tab) {
/* tabs.onUpdated */
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab){
status = changeInfo.status;
});
while (status != 'complete'){
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab){
status = changeInfo.status;
});
}
/* At this point, url tab is complete so I can capture it*/
});The problem is content_script.js cannot access chrome.tabs object. Then I though that code should be onbackground.js. However, background.js does not know when the current webpage matches the pattern.
Any idea of doing this? Thank you!
PD: I have already published this question in StackOverflow without getting any solution.
--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/11035fb8-c581-47d2-adae-9b831cd87bd8%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.
--
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
Well? Care to share with the rest of the class?
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/b05589db-1aef-4a97-a4ed-a5c58987ef1c%40chromium.org.