Chrome extension and using the icon button click to unload the extension.

80 views
Skip to first unread message

Laurence Lewis

unread,
Jun 17, 2022, 5:35:01 AM6/17/22
to Chromium Extensions
I am looking for guidance in developing a Chrome Extension and have not found a way to unload the extension when the Extension button in the browser toolbar is clicked, i.e. when the extension button is clicked the extension runs, when it is clicked again the extension is unloaded.

Can anyone help with links to Google documentation to help to develop this function or code example.

Thanks.

Regards
Laurence Lewis

hrg...@gmail.com

unread,
Jun 17, 2022, 8:46:20 PM6/17/22
to Chromium Extensions, laurence...@gmail.com
By "unloading the extension" do you mean to revert the changes made by the extension in the current page?
Or maybe what yo want is to open and close the extension page with the same toolbar button.

Describe in more detail what the extension does so we can point you in the right direction.

Laurence Lewis

unread,
Jun 17, 2022, 11:41:56 PM6/17/22
to hrg...@gmail.com, Chromium Extensions
Thanks for the response. 

The extension is called visual ARIA 

Currently when the extension runs there is a close extension button displayed. All this does is reload the page, when clicked, to remove all the extension scripts. 

I’d like to improve this behaviour so the page does not need to be reloaded . 

The reason is, if a developer makes temporary changes in developer tools, and needs to rerun the extension, they can. 

Please let me know if you need more information. 

Regards 
Laurence

hrg...@gmail.com

unread,
Jun 18, 2022, 1:41:04 AM6/18/22
to Chromium Extensions, laurence...@gmail.com, Chromium Extensions, hrg...@gmail.com
You can revert your changes by calling  chrome.tabs.removeCSS() for every call to chrome.tabs.insertCSS() that you made previously.

Laurence Lewis

unread,
Jun 18, 2022, 4:31:40 AM6/18/22
to hrg...@gmail.com, Chromium Extensions
Thanks I’ll research examples and see how I go. 😀
Reply all
Reply to author
Forward
0 new messages