Recently I decided to write a very simple Google Chrome extension. All it’s going to do is to hide some DOM-elements from the web-page using JavaScript when user presses the extension’s button.
Since I knew nothing about Chrome extensions, I started reading tutorials, and I came across this Google’s sample: A browser action with no icon that makes the page red
This sample is really close to what I want to make. The problem is that I can’t make it work. Whenever I load the extension in Chrome, I can see the button of this extension, but when I press it – nothing happens. Sample doesn’t work, probably I should know something I don’t know yet.
And before you started asking me:
- Yes, I tried restarting the browser;
- I use the newest version of Chrome.
Thanks for help.
If you open up the sample zip… find backgrond.js… edit.
Find the line that says:
and remove the “!important”. so it should read:
That is it. just save and reload the extension, should work (unless the page has an !important flag set to the background).
I am afraid I don’t know why the “!important” tag doesn’t work but I have never been able to get it to work in an extension. Hopefully someone else here will be able to give an explanation and maybe a work around.