Create a Safari WebExtension to Toggle a class

116 views Asked by At

I'm new to building web extensions and I'm struggling to do some simple action. All I want is to click a button in the menubar to toggle a class. Seems like most examples I have found are out of date or are Chrome specific?

Does someone have any pointers for how to accomplish this?

1

There are 1 answers

0
johncitizen On

All I want is to click a button in the menubar to toggle a class.

If I am understanding this correctly, the menubar that you have mentioned here is not the menubar from the native MacOS, but the toolbar from the Safari browser as hinted in this context.

This project might be useful for your intended use case as described in the quesetion, which is a sample project of how to create a browser action that will show up on the browser toolbar and you may then potentially manipulate the content of the webpage from there onwards.

For more information on creating web extension you may also find MDN browser extension tutorials helpful.