By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,625 Members | 1,740 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,625 IT Pros & Developers. It's quick & easy.

IP Address

P: n/a
I'm new to this group on here, but I wanted to know if anyone knows how to
display an IP address using javascript. Thanks in advance.

Randy
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
MRBEATZ wrote:
I'm new to this group on here, but I wanted to know if anyone knows how to
display an IP address using javascript. Thanks in advance.


No. JS has no way of determining the IP Address so it has no way to
display it, on its own.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2

P: n/a
On Sat, 05 Mar 2005 22:33:27 -0500 Randy Webb wrote:
MRBEATZ wrote:
I'm new to this group on here, but I wanted to know if anyone knows how
to display an IP address using javascript. Thanks in advance.


No. JS has no way of determining the IP Address so it has no way to
display it, on its own.


http://javascript.internet.com/user-...p-address.html

Actually, it sneaks in a simple line of php coding to do it.
I have seen some total javascripts do the trick.
Question is will they actually detect the true IP of the visitor's machine
or not?
To better trap the IP would be best done server side with php.

Jul 23 '05 #3

P: n/a
Richard wrote:
On Sat, 05 Mar 2005 22:33:27 -0500 Randy Webb wrote:

MRBEATZ wrote:

I'm new to this group on here, but I wanted to know if anyone knows how
to display an IP address using javascript. Thanks in advance.
No. JS has no way of determining the IP Address so it has no way to
display it, on its own.

http://javascript.internet.com/user-...p-address.html


That site does not use JS to get the IP Address, only to display it. It
relies on server side scripting to attempt to get the IP Address. Before
attempting to correct me in the future, try actually reading (and
understanding) what I said. You do know though that they have a *reason*
for calling you RtS?
Actually, it sneaks in a simple line of php coding to do it.
Actually, its not PHP, but it is a server side scripting language.
PHP code does not start:
<!--#echo var="REMOTE_ADDR"-->

PHP tags either start with <? or <?PHP
I have seen some total javascripts do the trick.
No you haven't. But you are welcome to *attempt* to prove me wrong.
Question is will they actually detect the true IP of the visitor's machine
or not?
Doesn't matter since IP addresses are as worthless as the hairs on a
chicken's ass.
To better trap the IP would be best done server side with php.


And if a user does not have PHP available? Hmmmm

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #4

P: n/a
MRBEATZ wrote on 06 mrt 2005 in comp.lang.javascript:
I'm new to this group on here, but I wanted to know if anyone knows
how to display an IP address using javascript. Thanks in advance.


document.write("123.456.1.1");

Is it about displaying "an" IP or
about determining what your own IP is?

The server often sees another IP adres [router, proxi],
than your browser uses.

Serverside asp example using clientside javascript to display:

document.write("<%=request.servervariables("remote _addr")%>");

With pure clientside javascript it is impossible, I believe.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.