Using Internet Browser information – Javascript
We all know that we use various internet browsers for surfing internet like Internet Explorer, Mozilla Firefox, Safari, Opera , Google Chrome etc. There browsers are generally available for most of the platforms and some are specific to platforms like IE can be run only on Windows platform. Mozilla Firefox can be run on many platforms like Windows, linux, mac etc.
These browser generally follow certain standards to render your web pages but there are few things which they do differently or because of some thing handled in some specific way, it may behave differently on different platform. In result, you may want to tweak your pages accordingly, so that your page should display correctly on all the platform and all the browsers.
Here I am trying list all the properties which can be retrieved using JavaScript and can be used for making decision which page tweak to choose according to the browser and platform or any other property:
function showNavigatorProperties(){ var navigatorDetails = ''; navigatorDetails += 'App Code Name : ' + navigator.appCodeName + '<br/>'; navigatorDetails += 'App Name : ' + navigator.appName + '<br/>'; navigatorDetails += 'App Version : ' + navigator.appVersion + '<br/>'; navigatorDetails += 'Cookie Enabled : ' + navigator.cookieEnabled + '<br/>'; navigatorDetails += 'Language : ' + navigator.language + '<br/>'; navigatorDetails += 'Platform : ' + navigator.platform + '<br/>'; navigatorDetails += 'User Agent : ' + navigator.userAgent + '<br/>'; var detailsDiv = document.getElementById("navigatordetails"); detailsDiv.innerHTML = navigatorDetails; }
<body onload="javascript:showNavigatorProperties();"> <div id="navigatordetails" style="font-family:arial,helvetica,clean,sans-serif;"></div> </body>
Below is the execution of code above and you can see some of the information about your browser and platform:
This information can also be used for reading the language information and redirecting to appropriate page accordingly.
Most Commented Posts
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

[...] recently i posted an article about knowing your browser and platform and handle your code and website pages accordingly as you can style elements or write functions for [...]