Breaking News
yeni film izle hd film seyret film izle

DOM Navigator In JavaScript

Navigator contains information about the client’s browser. A user surfs the internet using a browser program like internet explorer or Netscape navigator. These programs are quite smart programs. Javascript Navigator object contains information about user’s browser program. The properties and methods of navigator object are listed below.
 
Properties:
appName
onLine
platform
appCodeName
appVersion
 
Methods
JavaEnabled()
 
 
Properties
appName()
 
This navigator property returns the current browser’s name. Different users use different browser program many times it becomes very necessary to know the browser name of the user because it is possible that some particular command do not work on some specific browser. To know the name of the browser we can use this method.
 
Example:
 
<html>

<head>

</head>

<body bgcolor=red text=yellow>

<script type=”text/javascript”>

document.write(“<br>My current browser is : “+navigator.appName)

</script>

</body>

</html>

Click here to view result of this program on browser
 
 
onLine ()
 
This navigator property returns true if the computer is in offline mode else false. If our computer is online this method returns false else it returns true.
 
Example:
 
<html>

<head>

</head>

<body bgcolor=red text=yellow>

<script type=”text/javascript”>

document.write(“<br>My current browser is : “+navigator.onLine)

</script>

</body>

</html>

Click here to view result of this program on browser
 
 
platform ()
 
This navigator property returns the operating system platform. Any operating system follows a platform (some basic rules set) , like whether it is 16 bit program or 32 bit program. This method provides facility to know the operating system platform so that with this knowledge the user can put desired condition in his program.
 
Example:
 
<html>

<head>

</head>

<body bgcolor=red text=yellow>

<script type=”text/javascript”>

document.write(“<br>My current operating system platform is : – “+navigator.platform)

</script>

</body>

</html>

Click here to view result of this program on browser
 
 
appCodeName ()
 
This navigator property returns browser’s code name. Every browser performs certain code. To know the code name of that browser we can use this method.
 
Example:
 
<html>

<head>

</head>

<body bgcolor=red text=yellow>

<script type=”text/javascript”>

document.write(“<br>My current operating system platform is : – “+navigator.appCodeName)

</script>

</body>

</html>

Click here to view result of this program on browser
 
 
appVersion ()
 
This navigator property returns browser’s platform and version (version is the advancement level). This property is used to know that what platform the user is using what is the version (advancement level) of user’s platform.
 
Example:
 
<html>

<head>

</head>

<body bgcolor=red text=yellow>

<script type=”text/javascript”>

document.write(“<br>My Browser’s Details : – “+navigator.appVersion)

</script>

</body>

</html>

Click here to view result of this program on browser
 
 
Method
JavaEnabled()
 
This navigator property returns true if the browser is java enabled else false. Java is a very powerful language, our web page may require connectivity to a Java program but in that case the browser should be java enabled. If the browser will not be java enabled then the functionalities programmed in java will not work properly. To know whether the browser is java enabled or not we can use this method.
 
Example:
 
<html>

<head>

</head>

<body bgcolor=red text=yellow>

<script type=”text/javascript”>

document.write(“<br>My Browser is Java Enabled ? : – “+navigator.javaEnabled())

</script>

</body>

</html>

Check Also

Functions Returning Values In Java Script

Function is a set of statements recognized by a name and can be used as …