csv-reader
csv-reader copied to clipboard
Properly reset the tab content in Chrome
In Firefox, the following code works:
browser.tabs.insertCSS({ file: '/popup/css/insert.css' });
// ...after, when Reset is clicked:
browser.tabs.removeCSS({ file: '/popup/css/insert.css' });
However, Chrome doesn't support .removeCSS() until version 87 (at the time of writing, still in beta).
So in Chrome I can't just remove the previously inserted CSS as I do in Firefox 🤷♂️.
Probable solution
To change the way the css is inserted: Instead of using the browser.tabs API, insert it in the html as a node.
That way it's possible to remove it later.
But this feels too complicated for what it is, plus the .removeCSS() already works on Firefox.
Current solution
So for now, the solution is to just reload the tab 🤷♂️.
- browser.tabs.removeCSS({ file: '/popup/css/insert.css' });
+ browser.tabs.reload();