Browser Detection

Browser Detection

Usually when we open a web page, there is a widget that shows information about web browsers we're using to open the page, complete with its version. Can we create the widget itself? Of course they can, by using a simple Javascript code, we can display information about the browser being used. Here is the code:

<title>Browser Detection with Javascript</title>
<font face=Arial>
<script type="text/javascript">
document.write("<p>Browser: ")
document.write("<b>" + navigator.appName + "</b></p>")
document.write("<p>Browserversion: ")
document.write("<b>" + navigator.appVersion + "</b></p>")
document.write("<p>Code: ")
document.write("<b>" + navigator.appCodeName + "</b></p>")
document.write("<p>Platform: ")
document.write("<b>" + navigator.platform + "</b></p>")
document.write("<p>Cookies enabled: ")
document.write("<b>" + navigator.cookieEnabled + "</b></p>")
document.write("<p>Browser's user agent header: ")
document.write("<b>" + navigator.userAgent + "</b></p>")

You will get a widget that contains the browser name, version, and other info. Look at the picture below :

Your website will look more attractive and professional.


Post a Comment