I have a browserAction extension testing on chrome 31.0.1650.57. I want to get active tab url when the user click on the extension icon, save it and use it later.
I am able to do that when using tabs permission. But this permission has a lot of power (that I don't need) and users are complaining about this.
I followed the article to switch to activeTab permission http://developer.chrome.com/extensions/activeTab but it only works when there is no popup. As you can see in the make_page_red example.
chrome.browserAction.onClicked.addListener(function(tab) { // No tabs or host permissions needed! console.log("★ tab.url", tab.url); });
You can check by changing the make_page_red example manifest file to add a default popup like this:
{ "name": "Page Redder", "description": "Make the current page red", "version": "2.0", "permissions": [ "activeTab" ], "background": { "scripts": ["background.js"], "persistent": false }, "browser_action": { "default_title": "Make this page red", "default_popup": "popup.html" ←------------------- }, "manifest_version": 2 }
Now because I have a default popup the browserAction.onClicked listener is not called anymore.
How can I get current tab url and still have my popup opening?
Thanks