faqts : Computers : Programming : Languages : JavaScript : Browser Settings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

188 of 298 people (63%) answered Yes
Recently 8 of 10 people (80%) answered Yes


How to get IP address of the browser when its operating behind a proxy/firewall? (applets...activex....??)
i have copied the code in my front page but it doesnt work. i dont have .asp setup.
Can u plz send me a simple javascript for .html page to do this job? just MAC address is required

Nov 23rd, 2006 22:39
Anzer M, Michael Scalise, Silvio Pedroso, Hari prasad, Qamar Ahmad, Built in ActiveX Problem in Windows XP

there are some problems with below ActiveX it wont work in two builds of
Windows XP. Details are
The components used 
<object classid="CLSID:76A64158-CB41-11D1-8B02-00600806D9B6"
id="locator" VIEWASTEXT></object>
<object classid="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223"
It works for all system except two. The specifications of the systems
are as follows:
IE version       - 6 
OS                   - Windows Xp Professional version
and Windows Xp Professional version 6.0.2900.2180.xpsp_sp2_gdr.050301-1519
The systems are configured exactly like the others. It seems that
something is restricting the Active X control from loading into the page.
Please let me know if there is any work around or patch to this problem...
You may use a client side javascript in order to discover the IP 
<script language="javascript">
(The solution above doesn't work. It retrieves only the public Ip 
address, not the IPaddress on the PC behind the firewall/router. My 
solution below does work, but it is a bit more complicated. Mike 
Scalise 9/18/2003)
This solution does retrieve IP addresses from behind a firewall. It 
does have limitations. The client computer must be running Windows. It 
requires ActiveX to be enabled in the browser. 
The first file uses Windows Management Instrumentation (WMI) to 
retrieve the physical address of your network card (MAC Address) and 
the IP address currently assigned to that computer. Remember, if client 
computer gets an address using DHCP, this Ip address may change daily. 
The MAC address never changes. It is burned into your network card and 
is supposed to be unique in the world. (In fact, microsoft uses the MAC 
address and the curent date and time to generate GUID's. )
The first page does an asyncronous call to the WMI system. When the 
async call it is done, then it then automatically posts the data to 
another file which displayed the results. Nifty cool.
Mike Scalise
Copy and paste the two ASPFiles below.
 The first ASP file- NIC5.ASP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
		<title>WMI Scripting HTML</title>
		<script FOR="foo" EVENT="OnCompleted(hResult, 
pErrorObject, pAsyncContext)" LANGUAGE="JScript">
		<script FOR="foo" EVENT="OnObjectReady(objObject, 
objAsyncContext)" LANGUAGE="JScript">
         if(objObject.IPEnabled != null && objObject.IPEnabled !
= "undefined" && objObject.IPEnabled == true)
                   if(objObject.MACAddress != null && 
objObject.MACAddress != "undefined")
                         MACAddr = objObject.MACAddress;
                   if(objObject.IPEnabled && objObject.IPAddress(0) != 
null && objObject.IPAddress(0) != "undefined")
                         IPAddr = objObject.IPAddress(0);
                   if(objObject.DNSHostName != null && 
objObject.DNSHostName != "undefined")
                      sDNSName = objObject.DNSHostName;
			<FONT color="red"><span 
ID="info"> </span>. </FONT>
			<object classid="CLSID:76A64158-CB41-11D1-8B02-
00600806D9B6" id="locator" VIEWASTEXT>
			<object classid="CLSID:75718C9A-F029-11d1-A1AC-
00C04FB6C223" id="foo">
			<script LANGUAGE="JScript">
             			var service = locator.ConnectServer();
             			var MACAddr ;
             			var IPAddr ;
             			var DomainAddr;
             			var sDNSName;
(foo, 'Win32_NetworkAdapterConfiguration');
<form method="POST" action="NICPost.asp" id="formfoo" name="formbar">
	<input type="hidden"  name="txtMACAddr">
	<input type="hidden"  name="txtIPAddr">
	<input type="hidden"  name="txtDNSName">
This is the second file. It is an ASP page, but you could change it to 
plain HTML and use Java to retrieve the form field values, if you 
		Network Interface Card Information Page
		You are at IP Address <STRONG>
		Your MAC address on your network card is <STRONG>
			<% =request.form("txtMACAddr")%>
		Your DNS Host name is <STRONG>
			<% =request.form("txtDNSName")%>
		To confirm your IP and MAC address information, go to 
the command prompt and 
		type in
		ASP reports that your IP Address is <STRONG>
		response.Write Request.Servervariables("REMOTE_ADDR")
		</STRONG>which is your external WAN IP address that 
anyone can see,
		but maybe be shared by hundreds of users if you use Net 
Address Translation 
		through a common router.
end of message