473,496 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Grab IP Address with JavaScript

Is it possible to grab a client side IP Address using JavaScript in an htm
page? I have a web page hosted on a non-ASP server and I want a piece of
code in JavaScript to grab the IP address of the client and send it to a web
page on another server. The other page will be ASP.

I need this for both Netscape and IE browsers.

Any ideas?
Jul 19 '05 #1
12 13281
Personally, I don't know. Try asking in a client-side group such as
..scripting.jscript.

Ray at work

"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is it possible to grab a client side IP Address using JavaScript in an htm
page? I have a web page hosted on a non-ASP server and I want a piece of
code in JavaScript to grab the IP address of the client and send it to a web page on another server. The other page will be ASP.

I need this for both Netscape and IE browsers.

Any ideas?

Jul 19 '05 #2
> Is it possible to grab a client side IP Address using JavaScript in an htm
page? I have a web page hosted on a non-ASP server and I want a piece of
code in JavaScript to grab the IP address of the client and send it to a web page on another server. The other page will be ASP.


Off topic, but yes, it's possible but you need more than Javascript. We do
it here using a Java Applet. We grab the IP with the trusted applet, then
using Javascript we write it to a cookie.
Jul 19 '05 #3
The server that's hosting the asp page can get the IP address from the
request.servervariables("remote_addr"). Of course, if the client machine is
behind a firewall, the client-side resolved IP would be different. But
unless that matters, let the server do it.

Ray at work

"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is it possible to grab a client side IP Address using JavaScript in an htm
page? I have a web page hosted on a non-ASP server and I want a piece of
code in JavaScript to grab the IP address of the client and send it to a web page on another server. The other page will be ASP.

I need this for both Netscape and IE browsers.

Any ideas?

Jul 19 '05 #4
ljb
I tried the following client side but it didn't seem 100% reliable. Seems
not everyone has Winsock installed.

strIP = CreateObject("MSWinsock.Winsock").LocalIP

If this thread moves to another group I don't want to lose track since I
haven't solved the problem yet.

LJB
Jul 19 '05 #5
ljb wrote:
Seems not everyone has Winsock installed.


really? must have been an oversight.

;o)

--
William Tasso - http://WilliamTasso.com
Jul 19 '05 #6
Hey guys sorry if this is off topic, I theorized that since I was sending to
ASP that it would be on target.

Again I apologize.

Larry

I will repost in the other group.

"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is it possible to grab a client side IP Address using JavaScript in an htm
page? I have a web page hosted on a non-ASP server and I want a piece of
code in JavaScript to grab the IP address of the client and send it to a web page on another server. The other page will be ASP.

I need this for both Netscape and IE browsers.

Any ideas?

Jul 19 '05 #7
Hey guys thanks again, the consensus is that the server has to handle this
and not the client side. I had hoped to avoid this in order to cut down on
processing overhead but that's life.

Larry
"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is it possible to grab a client side IP Address using JavaScript in an htm
page? I have a web page hosted on a non-ASP server and I want a piece of
code in JavaScript to grab the IP address of the client and send it to a web page on another server. The other page will be ASP.

I need this for both Netscape and IE browsers.

Any ideas?

Jul 19 '05 #8
Request.ServerVariables("REMOTE_ADDR") will return the IP that the http
request comes from. This is not necessarily the primary IP of the primary
NIC in the computer with the browser. It could be a firewall, a proxy
server, a router, etc., but this may not matter.

ip.asp:

<%
Response.Write "Your IP address is " &
Request.ServerVariables("REMOTE_ADDR")
%>
Ray at home

"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:Ot**************@TK2MSFTNGP10.phx.gbl...
Hey guys thanks again, the consensus is that the server has to handle this
and not the client side. I had hoped to avoid this in order to cut down on
processing overhead but that's life.

Larry
"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is it possible to grab a client side IP Address using JavaScript in an htm page? I have a web page hosted on a non-ASP server and I want a piece of
code in JavaScript to grab the IP address of the client and send it to a

web
page on another server. The other page will be ASP.

I need this for both Netscape and IE browsers.

Any ideas?


Jul 19 '05 #9
If you user has disabled scripting, you'll cut down on the client-side
processing too.

"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:Ot**************@TK2MSFTNGP10.phx.gbl...
Hey guys thanks again, the consensus is that the server has to handle this
and not the client side. I had hoped to avoid this in order to cut down on
processing overhead but that's life.

Larry
"Larry R. Baker" <lb****@eaglestrike.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is it possible to grab a client side IP Address using JavaScript in an htm
page? I have a web page hosted on a non-ASP server and I want a piece of
code in JavaScript to grab the IP address of the client and send it to a web page on another server. The other page will be ASP.

I need this for both Netscape and IE browsers.

Any ideas?


Jul 19 '05 #10

"Randy Rahbar" <rvrahbarAThotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Is it possible to grab a client side IP Address using JavaScript in an htm page? I have a web page hosted on a non-ASP server and I want a piece of
code in JavaScript to grab the IP address of the client and send it to a web
page on another server. The other page will be ASP.


Off topic, but yes, it's possible but you need more than Javascript. We

do it here using a Java Applet.

We grab the IP with the trusted applet, then using Javascript we write it

to a cookie.
Randy could you point me to a link on creating cookies? I need to create a
cookie for time and visit tracking, and I am clueless on how to create
cookie let alone use them.

BOB

Jul 19 '05 #11
> Randy could you point me to a link on creating cookies? I need to create a
cookie for time and visit tracking, and I am clueless on how to create
cookie let alone use them.


To write the cookie using server-side vbscript:
Response.Cookie("myCookie") = "This cookie is good!"

Now to read the cookie using server-side vbscript:
myVariable = Response.Cookie("myCookie")
Jul 19 '05 #12
> Now to read the cookie using server-side vbscript:
myVariable = Response.Cookie("myCookie")


Eep, I screwed up all together there (I'll blame it on the lack of coffee
this morning). Try this instead:

To write the cookie using vbscript:
Response.Cookies("myCookie") = "This cookie is REALLY good!"

Now to read the cookie using vbscript:
myVariable = Request.Cookies("myCookie")
Jul 19 '05 #13

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

Similar topics

3
7963
by: dan glenn | last post by:
hi. I want to code a 'preview' function into a guestbook entry page. I can do it with a button that posts, bringing up a whole new page showing a preview of what has been entered, and then the user...
0
2702
by: Baby Blue | last post by:
I have 2 code like below to grab a news website for my site. However, when I click some links (such as : http://wwww.vnexpress.net/xxx/xxxx ) inside the site which I want to grab, it has some...
2
3838
by: Yogev | last post by:
Hi, Looking for the solution: I want to click on my own button on ToolBar of IE6 and to activate the javascript that put the current URL (from location/address line of IE) to clipboard. My first...
2
9623
by: K.H. | last post by:
Hi Does anyone know how I can grab a video stream from an IP-address? There's a video web server for live image transmission in the Internet. Data transfer is accomplished via TCP/IP. The web cam...
8
9394
by: '69 Camaro | last post by:
Perhaps I'm Googling for the wrong terms. Does anyone have links to examples of the syntax necessary to read the HTML on another Web page when that HTML is produced from JavaScript using the...
1
1367
by: LaughOutLoud | last post by:
Hi. I wonder is it possible to grab everything in a form by calling one javascript function and turns it into array or object? E.g. <form id="form1" name="form1" method="post" action="">...
4
1438
by: Eric Layman | last post by:
HI, Im on dotnet 1.1 I've generated extra checkboxes, textboxes via client side javascript: eg: var inputElement = document.createElement('input'); inputElement.setAttribute('type',...
3
4409
by: dragonfly8563 | last post by:
Hi all, I created a listbox with employees' names and email addresses in it, and a button which grabs email address once it's clicked. Currently I can only pick up one address at a time, but I...
19
1850
by: JRough | last post by:
I have used this function to create a string called $headers: function GetHeaders($file_name){ return "<th><a href='".$file_name."&order_by=l_e'>L_E</a></th> <th><a href='"....
0
7120
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
6991
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6878
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
7373
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...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.