Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
SQL Server

Displaying the Browser Properties using Java Script.

Author: DevASP
Download Source Code :

This article is about how you can display the browser properties to your user which includes code name, color depth, platform, if java is enabled, resolution, ip address and hostname.


Steps you will do.



Start visual studio and create a new web application.


Open the HTML design of your web page and add the following JavaScript functions before closing the head tag.


<script language="JavaScript">


function display() {



colors = window.screen.colorDepth;

document.form.color.value = Math.pow (2, colors);

if (window.screen.fontSmoothingEnabled == true)

document.form.fonts.value = "Yes";

else document.form.fonts.value = "No";


document.form.navigator.value = navigator.appName;

document.form.version.value = navigator.appVersion;

document.form.colordepth.value = window.screen.colorDepth;

document.form.width.value = window.screen.width;

document.form.height.value = window.screen.height;

document.form.maxwidth.value = window.screen.availWidth;

document.form.maxheight.value = window.screen.availHeight;

document.form.codename.value = navigator.appCodeName;

document.form.platform.value = navigator.platform;

if (navigator.javaEnabled() < 1)"No";

if (navigator.javaEnabled() == 1)"Yes";


if(navigator.javaEnabled() && (navigator.appName != "Microsoft Internet Explorer")) {




alert("Your host name is '" + host + "'\nYour IP address is " + ip);






Add the following HTML code to design the layout of your web form.



< body OnLoad="display()">


<form name="form">

<table border="1" width="468" style="WIDTH: 468px; HEIGHT: 334px">


<td>current resolution:</td>

<td align="left"><input type="text" size="4" maxlength="4" name="width"> x

<input type="text" size="4" maxlength="4" name="height"></td>




<td align="left"><input type="text" size="20" maxlength="20" name="navigator"></td>



<td>max resolution:</td>

<td align="left"><input type="text" size="4" maxlength="4" name="maxwidth"> x <input type="text" size="4" maxlength="4" name="maxheight"></td>




<td align="left"><input type="text" size="20" maxlength="20" name="version"></td>



<td>color depth:</td>

<td align="left"><input type="text" size="2" maxlength="2" name="colordepth"> bit</td>



<td>code name:</td>

<td align="left"><input type="text" size="15" maxlength="15" name="codename"></td>




<td align="left"><input type="text" size="15" maxlength="15" name="platform"></td>




<td align="left"><input type="text" size="8" maxlength="8" name="color"></td>



<td>java enabled:</td>

<td align="left"><input type="text" size="3" maxlength="3" name="java"></td>



<td>anti-aliasing fonts:</td>

<td align="left"><input type="text" size="3" maxlength="3" name="fonts"></td>



<td colspan="2" align="center">

<input type="button" name="again" value="again?" onclick="display()"></td>






<font face="arial, helvetica">Dont forget to visit<br>

by <a href=""></a></font>





Now run your application and see the properties of your browser.



Add Article Comment:
Name :
Email Address :
Comments :
<< Getting the Browser Information using Java Script.

Disclaimer - Privacy
© 2002-2017