Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly reset the tab content in Chrome #4

Open
rubenvar opened this issue Nov 2, 2020 · 0 comments
Open

Properly reset the tab content in Chrome #4

rubenvar opened this issue Nov 2, 2020 · 0 comments

Comments

@rubenvar
Copy link
Owner

rubenvar commented Nov 2, 2020

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant