Definition and Usage Window Navigator..
The window.navigator object contains information about the visitor's browser.
The window.navigator object can be written without the window prefix.
Some examples:
Browser Application Name
The appName property returns the application name of the browser:
Browser Application Code Name
The appCodeName property returns the application code name of the browser:
The Browser Engine
The product property returns the product name of the browser engine:
The Browser Version
The appVersion property returns version information about the browser:
The Browser Agent
The userAgent property returns the user-agent header sent by the browser to the server:
Warning !!!
The platform property returns the browser platform (operating system):
The Browser Language
The language property returns the browser's language:
Is The Browser Online?
The onLine property returns true if the browser is online:
Is Java Enabled?
The javaEnabled() method returns true if Java is enabled:
Differents way how to declare Navigator in program.
CODING:The window.navigator object contains information about the visitor's browser.
The window.navigator object can be written without the window prefix.
Some examples:
- navigator.appName
- navigator.appCodeName
- navigator.platform
- Browser Cookies
Browser Application Name
The appName property returns the application name of the browser:
Browser Application Code Name
The appCodeName property returns the application code name of the browser:
The Browser Engine
The product property returns the product name of the browser engine:
The Browser Version
The appVersion property returns version information about the browser:
The Browser Agent
The userAgent property returns the user-agent header sent by the browser to the server:
Warning !!!
- The information from the navigator object can often be misleading, and should not be used to detect browser versions because:
- Different browsers can use the same name
- The navigator data can be changed by the browser owner
- Some browsers misidentify themselves to bypass site tests
- Browsers cannot report new operating systems, released later than the browse
The platform property returns the browser platform (operating system):
The Browser Language
The language property returns the browser's language:
Is The Browser Online?
The onLine property returns true if the browser is online:
Is Java Enabled?
The javaEnabled() method returns true if Java is enabled:
Differents way how to declare Navigator in program.
<!DOCTYPE html>
<html>
<body>
<p>Do not rely on it! "Mozilla" is the application code name for both Chrome, Firefox, IE, Safari, and Opera.</p>
<p>Strange enough, "Netscape" is the application name for both IE11, Chrome, Firefox, and Safari.</p>
<p>Do not rely on it! Most browsers returns "Gecko" as product name!</p>
<p id="demo"></p>
<script>
var text = "<b>navigator.appCodeName is:</b>" + navigator.appCodeName;
text += "<br><b>navigator.appName is:</b>" + navigator.appName;
text += "<br><b>navigator.cookieEnabled is:</b>" + navigator.cookieEnabled;
text += "<br><b>navigator.product is :</b>" + navigator.product;
text += "<br><b>appVersion is :</b>" + navigator.appVersion;
text += "<br><b>userAgent is :</b>" + navigator.userAgent;
text += "<br><b>platform is :</b>" + navigator.platform;
text += "<br><b>language is :</b>" + navigator.language;
text += "<br><b>onLine is :</b>" + navigator.onLine;
text += "<br><b>javaEnabled is :</b>" + navigator.javaEnabled();
document.getElementById("demo").innerHTML=text;
</script>
</body>
</html>
<html>
<body>
<p>Do not rely on it! "Mozilla" is the application code name for both Chrome, Firefox, IE, Safari, and Opera.</p>
<p>Strange enough, "Netscape" is the application name for both IE11, Chrome, Firefox, and Safari.</p>
<p>Do not rely on it! Most browsers returns "Gecko" as product name!</p>
<p id="demo"></p>
<script>
var text = "<b>navigator.appCodeName is:</b>" + navigator.appCodeName;
text += "<br><b>navigator.appName is:</b>" + navigator.appName;
text += "<br><b>navigator.cookieEnabled is:</b>" + navigator.cookieEnabled;
text += "<br><b>navigator.product is :</b>" + navigator.product;
text += "<br><b>appVersion is :</b>" + navigator.appVersion;
text += "<br><b>userAgent is :</b>" + navigator.userAgent;
text += "<br><b>platform is :</b>" + navigator.platform;
text += "<br><b>language is :</b>" + navigator.language;
text += "<br><b>onLine is :</b>" + navigator.onLine;
text += "<br><b>javaEnabled is :</b>" + navigator.javaEnabled();
document.getElementById("demo").innerHTML=text;
</script>
</body>
</html>
Comments
Post a Comment