Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7679549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:54:12+00:00 2026-05-31T17:54:12+00:00

I have 5 addons/extensions for Firefox, Chrome, Internet Explorer(IE), Opera, and Safari. How can

  • 0

I have 5 addons/extensions for Firefox, Chrome, Internet Explorer(IE), Opera, and Safari.

How can I correctly recognize the user browser and redirect (once an install button has been clicked) to download the corresponding addon?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:54:13+00:00Added an answer on May 31, 2026 at 5:54 pm

    Googling for browser reliable detection often results in checking the User agent string. This method is not reliable, because it’s trivial to spoof this value.
    I’ve written a method to detect browsers by duck-typing.

    Only use the browser detection method if it’s truly necessary, such as showing browser-specific instructions to install an extension. Use feature detection when possible.

    Demo: https://jsfiddle.net/6spj1059/

    // 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' && window['safari'].pushNotification));
    
    // Internet Explorer 6-11
    var isIE = /*@cc_on!@*/false || !!document.documentMode;
    
    // Edge 20+
    var isEdge = !isIE && !!window.StyleMedia;
    
    // Chrome 1 - 79
    var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
    
    // Edge (based on chromium) detection
    var isEdgeChromium = isChrome && (navigator.userAgent.indexOf("Edg") != -1);
    
    // 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 += 'isEdgeChromium: ' + isEdgeChromium + '<br>';
    output += 'isBlink: ' + isBlink + '<br>';
    document.body.innerHTML = output;

    Analysis of reliability

    The previous method depended on properties of the rendering engine (-moz-box-sizing and -webkit-transform) to detect the browser. These prefixes will eventually be dropped, so to make detection even more robust, I switched to browser-specific characteristics:

    • Internet Explorer: JScript’s Conditional compilation (up until IE9) and document.documentMode.
    • Edge: In Trident and Edge browsers, Microsoft’s implementation exposes the StyleMedia constructor. Excluding Trident leaves us with Edge.
    • Edge (based on chromium): The user agent include the value "Edg/[version]" at the end (ex: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.16 Safari/537.36 Edg/80.0.361.9").
    • Firefox: Firefox’s API to install add-ons: InstallTrigger
    • Chrome: The global chrome object, containing several properties including a documented chrome.webstore object.
    • Update 3 chrome.webstore is deprecated and undefined in recent versions
    • Safari: A unique naming pattern in its naming of constructors. This is the least durable method of all listed properties and guess what? In Safari 9.1.3 it was fixed. So we are checking against SafariRemoteNotification, which was introduced after version 7.1, to cover all Safaris from 3.0 and upwards.
    • Opera: window.opera has existed for years, but will be dropped when Opera replaces its engine with Blink + V8 (used by Chromium).
    • Update 1: Opera 15 has been released, its UA string looks like Chrome, but with the addition of "OPR". In this version the chrome object is defined (but chrome.webstore isn’t). Since Opera tries hard to clone Chrome, I use user agent sniffing for this purpose.
    • Update 2: !!window.opr && opr.addons can be used to detect Opera 20+ (evergreen).
    • Blink: CSS.supports() was introduced in Blink once Google switched on Chrome 28. It’s of course, the same Blink used in Opera.

    Successfully tested in:

    • Firefox 0.8 – 61
    • Chrome 1.0 – 71
    • Opera 8.0 – 34
    • Safari 3.0 – 10
    • IE 6 – 11
    • Edge – 20-42
    • Edge Dev – 80.0.361.9

    Updated in November 2016 to include detection of Safari browsers from 9.1.3 and upwards

    Updated in August 2018 to update the latest successful tests on chrome, firefox IE and edge.

    Updated in January 2019 to fix chrome detection (because of the window.chrome.webstore deprecation) and include the latest successful tests on chrome.

    Updated in December 2019 to add Edge based on Chromium detection (based on the @Nimesh comment).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an ActiveX. ActiveX means: Internet Explorer native binary code running from a
I have a question about the log of Firefox Browser. I am implement the
I've developed an extension for firefox and google chrome , safari and ie8+ .
I am learning to create addons for Firefox and I have a question about
I am using the new FireFox Addons SDK to develop an extension. I have
Compared to scripts within a page, what extra powers do addons/extensions have? They are
Have just started using Google Chrome , and noticed in parts of our site,
I'm having a weird error with Internet Explorer (Currently version 8, but had the
I have a working firefox extension that currently consists of a button. When I
I'm using Selenium RC with chrome-mode for Firefox to automate test cases for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.