Navigator object
Navigator Object has a lot of uses in javascript. This object is used to find the location we needed, whether the browser is in online mode or not, whether Java is enabled or not in our system, etc. Let's discuss some of its uses.
Example-1
In the following example, the navigator object is used to find whether the browser is in online mode or not. At the time of running the code, my system is in online mode so true is displayed in the output.
<html> <body> <script> var x = "Is your browser is in online mode? " + navigator.onLine; document.write(x); </script> </body> </html>
Output
Is your browser is in online mode? true
Example-2
In the following example, the navigator object is used to find whether java is enabled in the pc or not. The time I am running my code, Java is not installed in the pc so false is executed in the output.
<html> <body> <script> var x = "Is java Enabled in your pc:" + navigator.javaEnabled(); document.write(x); </script> </body> </html>
Output
Is java Enabled in your pc: false