Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Getting the Name of the Browser

Getting the Name of the Browser

Scheduled Pinned Locked Moved JavaScript
javascriptsecurityquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BobInNJ
    wrote on last edited by
    #1

    I ran the following JavaScript code: alert( "browers is " + navigator.appName ); The browser I was using is Chrome. I expected to get the string Google Chrome but instead I got: Am I missing something? I am thinking that my security software is changing the name of the string to protect my system and/or my privacy. Is that right? Thanks, Bob

    F Richard DeemingR 2 Replies Last reply
    0
    • B BobInNJ

      I ran the following JavaScript code: alert( "browers is " + navigator.appName ); The browser I was using is Chrome. I expected to get the string Google Chrome but instead I got: Am I missing something? I am thinking that my security software is changing the name of the string to protect my system and/or my privacy. Is that right? Thanks, Bob

      F Offline
      F Offline
      F ES Sitecore
      wrote on last edited by
      #2

      It doesn't look like that property has much value Navigator appName Property[^] If you want to know the browser you'll probably need to interrogate the user agent How to Use JavaScript to Detect Browser | Learning jQuery[^] These days doing things depending on the browser is frowned upon, instead you should interrogate the browser to see if it supports the feature you want to use.

      M 1 Reply Last reply
      0
      • B BobInNJ

        I ran the following JavaScript code: alert( "browers is " + navigator.appName ); The browser I was using is Chrome. I expected to get the string Google Chrome but instead I got: Am I missing something? I am thinking that my security software is changing the name of the string to protect my system and/or my privacy. Is that right? Thanks, Bob

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        NavigatorID.appName - Web APIs | MDN[^]:

        This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time. ... Do not rely on this property to return the correct browser name. In most browsers (like Firefox, Chrome, Safari, Opera and Internet Explorer) the returned string is "Netscape".

        You should generally avoid browser detection, and use feature detection instead: Browser Detection (and What to Do Instead)[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        1 Reply Last reply
        0
        • F F ES Sitecore

          It doesn't look like that property has much value Navigator appName Property[^] If you want to know the browser you'll probably need to interrogate the user agent How to Use JavaScript to Detect Browser | Learning jQuery[^] These days doing things depending on the browser is frowned upon, instead you should interrogate the browser to see if it supports the feature you want to use.

          M Offline
          M Offline
          mappleleaf
          wrote on last edited by
          #4

          It is true that you should check to see if a browswer supports the feature you wish to use. As for the fact that the alert returns Nestscape goes back to the history of Javascript. Here is a quick Google research post (hope you can see why it returns Netscape' 'JavaScript, not to be confused with Java, was created in 10 days in May 1995 by Brendan Eich, then working at Netscape and now of Mozilla. JavaScript was not always known as JavaScript: the original name was Mocha, a name chosen by Marc Andreessen, founder of Netscape.Jun 27, 2012'

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups