I am trying to build a chrome extension. Want it to be always enabled.
I tried to do it in the following way:
chrome.declarativeContent.onPageChanged.removeRules(undefined, function(){
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [new chrome.declarativeContent.PageStateMatcher({pageUrl: { urlContains: '*' },})],
actions: [new chrome.declarativeContent.ShowPageAction()]
}]);
});
But it doesn't seem to work correctly. How to get this done?
If you just want your icon to be visible all the time, the standard way to do that is through the browser_action
field in your manifest.json
file:
{
"browser_action": {
"default_icon": {
"32": "images/icon32.png" // Chrome supports various icon sizes (in pixels)
},
"default_title": "Title", // The title that shows up when a user hovers on your icon
"default_popup": "popup.html" // The URL of your popup page
}
}
Presumably, it should be the same as whatever page_action
entry you already have.
For more details, see: https://developer.chrome.com/extensions/browserAction
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