473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can I get my local IP address from javascript under IE?

Can I get my local IP address from javascript under IE? I've some pieces of
code that work under netscape, but it doesnt under ie.

Thanks in advance,

tlotr

Jul 20 '05 #1
2 27856
tlotr wrote:
Can I get my local IP address from javascript under IE? I've some pieces of
code that work under netscape, but it doesnt under ie.

Thanks in advance,

tlotr


It depends, if the document is loading off an HTTP server, then no, you can't
obtain your IP address without lowering your security settings to dangerously
low levels (or putting the site in your Trusted Zone).

If the file is being loaded from a local drive, or you've lowered your security
settings, or you've put a site in the Trusted Zone, it shouldn't be too hard to
cobble something together with a WShell.Scripting object and ipconfig.exe.
There may be an easier way to do it as well, I haven't given it much thought.

It would be something like:

<script type="text/javascript">
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("ipconfig.exe > c:\\ipconfig.txt", 2, true);
</script>

But that doesn't actually work, so you'd most likely have to create a .CMD file
on the drive with the command you want, then WshShell.Run() that, or possibly
there is a Registry key you could read to obtain that information.

Again though, none of this is going to work on any copy of IE except yours,
assuming you've lowered the security enough to let it run, and agree to let it
run when it prompts you.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #2
I think I'll be able to solve it the way you said. Thanks a lot Grant.
Regards,
-T-

"Grant Wagner" <gw*****@agricoreunited.com> escribió en el mensaje
news:3F***************@agricoreunited.com...
tlotr wrote:
Can I get my local IP address from javascript under IE? I've some pieces of code that work under netscape, but it doesnt under ie.

Thanks in advance,

tlotr
It depends, if the document is loading off an HTTP server, then no, you

can't obtain your IP address without lowering your security settings to dangerously low levels (or putting the site in your Trusted Zone).

If the file is being loaded from a local drive, or you've lowered your security settings, or you've put a site in the Trusted Zone, it shouldn't be too hard to cobble something together with a WShell.Scripting object and ipconfig.exe.
There may be an easier way to do it as well, I haven't given it much thought.
It would be something like:

<script type="text/javascript">
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("ipconfig.exe > c:\\ipconfig.txt", 2, true);
</script>

But that doesn't actually work, so you'd most likely have to create a .CMD file on the drive with the command you want, then WshShell.Run() that, or possibly there is a Registry key you could read to obtain that information.

Again though, none of this is going to work on any copy of IE except yours, assuming you've lowered the security enough to let it run, and agree to let it run when it prompts you.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...3/reference/fr
ames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...l_reference_en
try.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: war_wheelan | last post by:
I have two servers running SQL Server on the same network and I am receiving errors registering the various instances as follows: SERVER1 tried to register the local instance (by netname, ip...
6
by: Jean-Michel | last post by:
Hi, I'd like to launch a local application with a HTML page without any user popup validation, just a user click. I know that I can do it with a applet, ActiveX or a flash but I'd like manage it...
23
by: Timothy Madden | last post by:
Hello all. I program C++ since a lot of time now and I still don't know this simple thing: what's the problem with local functions so they are not part of C++ ? There surely are many people...
6
by: Brad | last post by:
I have a win2003 server workstation with multiple webs, each web has it's own ip address. In VS2005, if I select to open an existing web site, select Local IIS, the dialog correctly displays a...
4
by: Tom | last post by:
I come from C but don't really understand why in C++ you can return a temporary object from a function. For example: class Test { public: Test() { cout << "Address of object: " <<this...
5
by: Hooyoo | last post by:
Hi, here, How to get local machine name and IP address? Thanks.
8
by: mouac01 | last post by:
I'm not sure if this is possible. I would like to have a PHP app on the Internet connect and write to a local database (Intranet). For example, users would go to a web site...
1
by: =?Utf-8?B?QWdlbmR1bQ==?= | last post by:
I have an issue where I have a remote IP Address, and I need to discover the local network interface IP Address which is viewable to the remote IP Address (for UPnP document purposes). For...
7
by: RN1 | last post by:
Is it possible to connect to my local SQL Server 2005 database from a remote web server? If yes, what ConnectionString do I use? Thanks, Ron
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.