How to use Navigator Object in JavaScript

In this article I am going to explain about Navigation object in JavaScript.
  • 2461

JavaScript Navigator Object

JavaScript Navigator object contain information about browser application. Its can be use for get any type of information about browser.

Syntax // Syntax for get browser name

navigator.appCodeName

 

Example // This example will display version info

 

<html>

<head>

    <script type="text/javascript">

        function Myfun() {

            document.write("Version info: " + navigator.appVersion);

        }

    </script>

</head>

<body>

    <button onclick="Myfun()">

        click me</button>

</body>

</html>

 

Output

 

 verssf.jpg

 

Example // This example will display browser name

 

<html>

<head>

<script type="text/javascript">

    function Myfun() {

        document.write("Name: " + navigator.appCodeName);

    }

</script>

</head>

<body>

 

<button onclick="Myfun()">click me</button>

 

</body>

</html>

 

Output

 

 verName.jpg

You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.