A
A
Alex2019-07-11 18:59:55
API
Alex, 2019-07-11 18:59:55

How to determine from which store the extension is installed?

I have an extension which is published in three stores:

  1. chrome web store
  2. Opera add-ons
  3. Firefox add-ons

But, for example, you can install an extension from the "Chrome Web Store" in Opera. And in Yandex.Browser from "Chrome web store" and "Opera add-ons". Can I somehow programmatically determine from which store the extension is installed? I need to display in the interface a link to the extension page in this store. And it will not be very correct if the user installed the extension from "Opera Add-ons" and I will send it to the "Chrome Web Store"

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene Chefranov, 2019-07-11
@Kozack

Determine the browser (Opera, Chrome, Firefox) and substitute the desired link

// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;

// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';

// Safari 3.0+ "[object HTMLElementConstructor]" 
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification));

// Internet Explorer 6-11
var isIE = /*@[email protected]*/false || !!document.documentMode;

// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;

// Chrome 1 - 71
var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);

// Blink engine detection
var isBlink = (isChrome || isOpera) && !!window.CSS;


var output = 'Detecting browsers by ducktyping:<hr>';
output += 'isFirefox: ' + isFirefox + '<br>';
output += 'isChrome: ' + isChrome + '<br>';
output += 'isSafari: ' + isSafari + '<br>';
output += 'isOpera: ' + isOpera + '<br>';
output += 'isIE: ' + isIE + '<br>';
output += 'isEdge: ' + isEdge + '<br>';
output += 'isBlink: ' + isBlink + '<br>';
document.body.innerHTML = output;

A
Anton Shamanov, 2019-07-11
@SilenceOfWinter

Why define it? collect 3 extensions with different links and that's it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question