Click here to Skip to main content
11,720,785 members (63,438 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Javascript
i want to display ip address and mac address of pc i have the following code but it does not working in my system please check this..
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Getting MAC Address From Javascript(IE Only)</title>
<script language="javascript">
function showMacAddress(){
	var obj = new ActiveXObject("WbemScripting.SWbemLocator");
	var s = obj.ConnectServer(".");
	var properties = s.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
	var e = new Enumerator (properties);
	var output;
	output='<table border="0" cellpadding="5px" cellspacing="1px" bgcolor="#CCCCCC">';
	output=output + '<tr bgcolor="#EAEAEA"><td>Caption</td><td>MACAddress</td></tr>';
		var p = e.item ();
		if(!p) continue;
		output=output + '<tr bgcolor="#FFFFFF">';
		output=output + '<td>' + p.Caption; + '</td>';
		output=output + '<td>' + p.MACAddress + '</td>';
		output=output + '</tr>';
	output=output + '</table>';
	<input type="button" value="Show MAC Address" onclick="showMacAddress()" />
	<div id="box">
Posted 1-Apr-13 21:02pm
Edited 1-Apr-13 21:06pm
(no name)27.1K
Style-7 at 2-Apr-13 4:58am
this may be disable by admin policy
this is not safe for user
Madhugundi at 3-Apr-13 1:29am
means what

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 2,179
1 OriginalGriff 924
2 F-ES Sitecore 640
3 Maciej Los 609
4 Richard MacCutchan 540

Advertise | Privacy | Mobile
Web04 | 2.8.150901.1 | Last Updated 2 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100