Is it possible to set the browser action button disabled? or cancel the popup when a condition is true?
Bob
Page actions represent actions that can be taken on the current page, but that aren't applicable to all pages. Page actions appear grayed out when inactive. Like browser actions, page actions can have an icon, a tooltip, and popup; they can't have badges, however. In addition, page actions can be grayed out.
A browser action is a button that your extension adds to the browser's toolbar. The button has an icon, and may optionally have a popup whose content is specified using HTML, CSS, and JavaScript.
browserAction. Use browser actions to put icons in the main Google Chrome toolbar, to the right of the address bar. In addition to its icon, a browser action can have a tooltip, a badge, and a popup.
You can remove popup body with:
chrome.browserAction.setPopup({popup: ""});
and switch icon to disabled with:
chrome.browserAction.setIcon({path: "icon-disabled.png"});
To enable, you would need to run those methods again with corresponding params.
You can set it disable with following code:
chrome.browserAction.enable(integer tabId);
You find more information in the Chrome Apis:
http://developer.chrome.com/extensions/browserAction.html#method-disable
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