Reputation: 1219
I have a Chrome extension that inserts some mark-up into webpages. This mark-up is usually hidden by the CSS that the extension inserts.
When the user switches the extension off using the extension's browser button, I remove all mark-up using the content script. However, when the extension is uninstalled, or disabled, the mark-up is left on the webpage, but the CSS that's hiding it is uninstalled. This leaves quite a deformed webpage.
Is there any way of cleaning up this inserted mark-up before the content-script and css are removed?
Thanks!
Upvotes: 2
Views: 856
Reputation: 1219
Posting the solution I eventually went with.
Chrome has a quirk where css inserted automatically by extensions (listed in manifest) is removed when the extension is removed when the extension is uninstalled. However, css inserted programmatically by the extension is left in place.
So, I switched my css insertion from manifest to programmatic. Now, even when the user uninstalls the extension, the CSS stays on page hiding my markup. Till next page reload, when both the CSS and the markup are discarded.
Not sure this injected CSS non-removal behaviour is a feature or a bug, but it's working for now.
Upvotes: 1