Open In App

HTML DOM Navigator appCodeName Property

Last Updated : 14 Jun, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The Navigator appCodeName Property is used for returning the code name of the browser. It is a read-only property and generally, all modern browsers return “Mozilla”.

Syntax:

navigator.appCodeName

Return values: Returns a string that represents the code name of the browser.

Below program illustrates the Navigator appCodeName Property:
1. Getting the code name of the browser.




<!DOCTYPE html>
<html>
  
<head>
    <title>
      Navigator appCodeName Property in HTML
    </title>
    <style>
        h1 {
            color: green;
        }
          
        h2 {
            font-family: Impact;
        }
          
        body {
            text-align: center;
        }
    </style>
</head>
  
<body>
  
    <h1>GeeksforGeeks</h1>
    <h2>Navigator appCodeName Property</h2>
  
    <p>
      For returning the codename of the current browser,
      double click the "Return Browser Codename" button:
    </p>
  
    <button ondblclick="codename()">
      Return Browser Codename
    </button>
  
    <p id="BrowserName"></p>
  
    <script>
        function codename() {
            var b = 
                "Browser's CodeName : " + navigator.appCodeName;
            document.getElementById("BrowserName").innerHTML = b;
        }
    </script>
  
</body>
  
</html>             


Output:

After clicking the button

Supported Browsers: The browser supported by Navigator appCodeName Property listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads