6
1 Comment

Trying to build browsers extensions without an api

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?

  1. 2

    In my extension, I’m doing something pretty similar. In my background.js I set a browser.browserAction.onClicked listener where the key part is:

    browser.tabs.create({
            "url": "https://podqueue.fm/add_url/extension/" + apikey_string + encoded_url
          });
    

    You should be able to change this to browser.tabs.update to 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 need tabs and/or activeTab for 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.

Trending on Indie Hackers
We've bootstrapped to $1.6m ARR in a crowded market. AMA. 46 comments We just reached a major milestone: $500k ARR 🔥 24 comments I bought Twitter•fm. What should I do with it? 7 comments Tiiny Host hits $2,000 MRR 📈🎉 7 comments Building MVP, looking for a sparring partner/accountability buddy 6 comments We are LIVE on Product Hunt 🚀🚀 4 comments