Search code examples
javascriptgoogle-chromegoogle-chrome-devtoolsnavigator

Why does navigator variable in Chrome show Mozilla/Gecko in some places?


I am trying to detect what browser a user is using my web app on and, interestingly, when I check the navigator variable, it shows me some values like this -

navigator variable in Chrome console

Now I don't understand why appCodeName is 'Mozilla' and appName is 'Netscape' Also, why is navigator.product showing 'Gecko'?

Could someone decode this please?


Solution

  • According to the WHATWG's HTML Living Standard, navigator.appCodeName must return Mozilla, and navigator.appName must return Netscape (i.e., all modern browsers return the same values). These values are deprecated, and going forward, will be removed altogether. The only reason they are still around is for backwards compatibility; their removal could break an app that depends on them. As with other web standards, we are in a bit of a transitional phase.