Click here to Skip to main content
15,886,106 members
Articles / Programming Languages / C#
Alternative
Tip/Trick

Displaying System IP address, Browser Name and Version

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
22 Nov 2011CPOL 14.7K   2   2
One way to get browser details is using JavaScript. Take a look at the following code: var StrDummy = navigator.appVersion; strVersion = StrDummy.substring(0,4); document.write("");...

One way to get browser details is using JavaScript. Take a look at the following code:


<script language="javascript" type="text/javascript">
var StrDummy = navigator.appVersion;
strVersion = StrDummy.substring(0,4);
document.write("<center><table border=1 cellpadding=2><tr><td>");
document.write("<center><b>", navigator.appName,"</b>");
document.write("</td></tr><tr><td>");
document.write("<center><table border=1 cellpadding=2><tr>");
document.write("<td>Code Name: </td><td><center>");
document.write("<b>", navigator.appCodeName,"</td></tr>");
document.write("<tr><td>Version: </td><td><center>");
document.write("<b>",strVersion,"</td></tr>");
document.write("<tr><td>Platform: </td><td><center>");
document.write("<b>", navigator.platform,"</td></tr>");
document.write("<tr><td>Pages Viewed: </td><td><center>");
document.write("<b>", history.length," </td></tr>");
document.write("<tr><td>Color depth: </td><td><center>");
document.write("<b>", window.screen.colorDepth," Bits </td></tr>");
document.write("<tr><td>Java enabled: </td><td><center><b>");
if (navigator.javaEnabled()){
document.write("Yes !</td></tr>");
if(navigator.appName != "Microsoft Internet Explorer") {
vartool=java.awt.Toolkit.getDefaultToolkit();
addr=java.net.InetAddress.getLocalHost();
host=addr.getHostName();
ip=addr.getHostAddress();
document.write("<tr><td>Host Name: </td><td><center>");
document.write("<b>",host,"</td></tr>");
document.write("<tr><td>IP Address: </td><td><center>");
document.write("<b>",ip,"</td></tr>");
}
}
else document.write("No!</td></tr>")
document.write("<tr><td>Screen Resolution: </td><td><center>");
document.write("<b>",screen.width," x ",screen.height,"</td></tr>");
document.write("</table></tr></td></table></center>");
</script>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Other Other
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralBut why use javascript when you can do the same thing in cod... Pin
#realJSOP21-Nov-11 1:26
mve#realJSOP21-Nov-11 1:26 
GeneralRe: But why use javascript when you can do the same thing in cod... Pin
Er. Mayank Jain6-Nov-12 0:50
Er. Mayank Jain6-Nov-12 0:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.