Search code examples
htmlgoogle-chromeinjectcrx

Inject/Remove HTML via Chrome Extension


I'm making a chrome extension and on a specific web page I have a table that has commented out information.

I'd like to remove the comment syntax so that the information is displayed in the table

What kind of content script would I need to parse the HTML for the specific comment syntax and then remove it?

Also, every time I pack my extension to a .crx file the file size nearly doubles. Is this standard? My 16 kb files are turning into a 40 MB extension- I'm worried that it isn't supposed to work like that.


Solution

  • First off, likely when you package your extension into a .crx file, you're putting the resulting .crx file in the same folder as your source files. Then the next time that you package the extension, instead of your source folder having just the files you want to package, it has the files you want to package plus the previous .crx file. Every time this happens you effectively (just over) double the file size. To prevent this, make sure the .crx file is getting saved to the parent directory.

    As far as the uncommenting HTML goes, I would check out this answer: Uncomment html code using javascript