0

I want a link on my website to a Google Chrome extension that has a Firefox alternative.

Questions:

  1. How do I link to a browser(Google Chrome/Firefox) plugin from a web-page?
  2. How do I decide which link to show based on users browser? In other words: when a person enters my web page using Firefox I want to display a link to Firefox plugin, if he's using Google Chrome - link to Google Chrome plugin.
Xan
  • 74,770
  • 16
  • 179
  • 206
drakonli
  • 2,304
  • 23
  • 29

1 Answers1

4

Both browsers present an API to initiate an extension/add-on install. You can actually use those to differentiate between browsers.

First, detection:

if(window.InstallTrigger) {
  // This is Firefox
} else if(window.chrome && window.chrome.webstore) {
  // This is Chrome
} else {
  // Something else
}

Next, you want to trigger the installation. This probably requires a user gesture - so present a button/link for the user to click.

I'm not an expert on Firefox, but here's the relevant documentation. I don't know how that interacts with Gallery, if you have the add-on published there.

For Chrome, you need to link the Web Store item to the site in question to use inline install. Once that is done, you can follow the procedure from relevant documentation.


Consider that you also want to detect if the extension is already installed. To do that, you need to expose something visible to the page, or modify the page, from the extension.

Again, I'm not an expert on FF, but here's the canonical Chrome question.

Community
  • 1
  • 1
Xan
  • 74,770
  • 16
  • 179
  • 206