Good day,
I'm trying to build a browser extension (chrome/firefox) for a project I'm maintaining. I already have a bookmarklet integration, but that's not enough, a lot of people still look for extensions for a browser.
I'm trying to find a shortest path to solve that, without building API.
In essence required functionality seems very simple. Click on a button and redirect to "https://app.briefcake.com/feeds/new?url=<current_url>". But it seems like extensions always try to open "extension menu" and there is no way to bind redirect action to button.
Maybe someone who has more experience building browser extensions, can give me advice how to solve this? any tips?
In my extension, I’m doing something pretty similar. In my
background.jsI set abrowser.browserAction.onClickedlistener where the key part is:You should be able to change this to
browser.tabs.updateto update the current tab URL instead of opening a new tab. Make sure you have the correct permissions declared in your manifest as well, you’ll likely needtabsand/oractiveTabfor this.By the way, you may want to add some sort of protection to that endpoint (you can see I use a pre-shared per-user “API key”), because otherwise someone will likely be able to use a CSRF attack to add links unless you have a manual interactive link confirmation by the user as an extra step.