Close window

View/Add Web Comments

105 previous comments
For Web page:
Add your comment
by: sriram on 2016-04-25 10:55:01
function findIP(onNewIP) { // onNewIp - your listener function for new IPs
var myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; //compatibility for firefox and chrome
var pc = new myPeerConnection({iceServers: []}),
noop = function() {},
localIPs = {},
ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g,


by: Miguel on 2016-02-04 21:12:07
How can I pass thru the PHP variable value VIH_HostIP so I can send this along with form data via ASP?
by: marvin on 2016-02-02 09:28:10
I want to change the
<script language="JavaScript" src=""></script>
can you send me this

by: Kyle on 2016-01-28 20:55:41
How would I adapt this code to change the link destination of an address depending on if the ip address is public or attempting to connect on the local network. For example if I was on the same network it would redirect me to the internal site and if I was entering from elsewhere then through the external ip
by: %%TIME%% on 2014-04-06 03:12:11
Hh Mm Ss nnnn
1 + 1 = 2 {TRUE}
Enum 5 - 1 = 4
1 - 5
always will be 4
include whereas
1 - 5
choice emmits 3
Wow im smart i wrote on a note pad and the script is broken...
Ok make it go...

by: David on 2013-05-28 21:40:08
There are no visitor URLs that actually show the script output on a web page. I would like to see it in action
by: ozz on 2013-02-15 16:57:09
Thanks a lot for the script. I used document.getElementById to store the ip address in a hidden field but found that it doesn't always work. Sometimes, the field would be empty. The source code is at Thanks again.
by: Jose on 2012-09-30 21:12:23

I am configured php code into xml file how gadget in google apps

I have a problem to visualize script using google chrome, using firefox or internet explorer is ok

Any solution? I need see local IP using chrome


by: Steves on 2012-08-03 16:52:02

if (VIH_HostIP="") {
VIH_DisplayOnPage = "yes";
} else {
VIH_DisplayOnPage = "no";

by: Steves on 2012-08-03 16:51:16
Got cut off:

<script language="JavaScript">
VIH_BackColor = "palegreen";
VIH_ForeColor = "navy";
VIH_FontPix = "16";
VIH_DisplayFormat = "You are visiting from:<br>IP Address: %%IP%%<br>Host: %%HOST%%";

if (VIH_HostIP="") {
VIH_DisplayOnPage = "yes";
} else {

by: Steve on 2012-08-03 16:50:22
Hi, I am trying to show a msg by ip but it will not work please please please help!

<script language="JavaScript">
VIH_BackColor = "palegreen";
VIH_ForeColor = "navy";
VIH_FontPix = "16";
VIH_DisplayFormat = "You are visiting from:<br>IP Address: %%IP%%<br>Host: %%HOST%%";

if (VIH_HostIP="") {

by: DAMS on 2012-05-09 12:29:36
I have used another type of info in my webpage (Go to Support on using HTML.
by: DAMS on 2012-05-09 12:27:50
I have used another type of info in my webpage (Support) using HTML.
by: Arvind Amarnath on 2012-04-25 11:54:03
Perfect write up.... this one helped out a lot to me... Thanks for sharing this script
by: alban on 2012-02-24 00:16:25
thank you very much ,im using it in my site
by: Harry on 2012-01-12 10:26:22
Doesn't show my IP - assume it sees a proxy.

by: Idris on 2011-12-04 12:15:43
awesome script..this saved me time and effort....thank you so much for sharing!!!
by: Bryan Barrios on 2011-11-01 14:08:21
Greetings, I used the script and it worked flawlessly. Now I want to use the other variables: VIH_HostIP, VIH_HostName; but I get a message saying they're undefined.
by: ninainai on 2011-08-27 12:06:51
Tnx a lot. Is there any script that by each visit, I receive any notification email?
by: Asghar Qambrani on 2011-06-24 16:47:35
Thanks Man....
by: Rakesh Tomar on 2011-06-20 11:16:40
its very impressive
by: Rakesh Tomar on 2011-06-20 11:16:40
its very impressive
by: glitcy on 2011-06-09 10:08:03
I want to get visitors ip without using your link
by: Sf3soft on 2011-04-26 03:01:53
Sorry for double post - hit refresh and it posted it twice -_-'
by: Sf3soft on 2011-04-26 03:00:22

You have to add this line

<script language="JavaScript" src=""></script>

after each portion (ie. one for displaying on the page, another for the title)

Example (working):
Posting the url... Right Click>View Source to see the code - not enough characters to display it here.


by: Sf3soft on 2011-04-26 03:00:00

You have to add this line

<script language="JavaScript" src=""></script>

after each portion (ie. one for displaying on the page, another for the title)

Example (working):
Posting the url... Right Click>View Source to see the code - not enough characters to display it here.


by: gellis12 on 2011-04-11 04:06:27
k, for some reason only half of the code showed up...

<script language="JavaScript">
VIH_DisplayFormat = "<title>Your IP address is: %%IP%%. Your host is: %%HOST%%</title>";
VIH_DisplayOnPage = "yes";
<script language="JavaScript" src=""></script>

by: gellis12 on 2011-04-11 04:04:26
you can also set the IP address as the page's title!
just type this in the head section, but remember to delete the original title line

<script language="JavaScript">
VIH_DisplayFormat = "<title>Your IP address is: %%IP%%. Your host is: %%HOST%%</title>";
VIH_DisplayOnPage = "yes";
<script language="JavaScript" src="http://scripts.hashemia

by: cww on 2011-03-19 23:30:44
so how do you control where it displays on the page ?
by: Web maker on 2011-03-10 23:42:35
I love this code! Thx
by: Jhonny on 2011-01-14 20:43:41
It's nice, but it's nicer if the visitor's ip isn't shown on the web page, but it's created in a new file, where just an admin has access. And more visitor, more ips stored.
by: shova on 2011-01-03 21:53:45
by: Kadhir on 2010-12-30 08:01:24
thanks a lot!!!!!!
by: Samra on 2010-10-26 13:35:46
Hi Hashemian,
I like your code but there is only one problem with your code. That is if you put the code on the page and try to refresh the page then after 3 try it displays the static ip which is
So please fix this bug.
Thanks in advance.
Cheers for an awesome code.

by: Quang on 2010-10-18 17:32:11
Works like a charm! Thank you!
by: Carlo on 2010-09-13 07:26:29
Thanks! Great script - displayed on and
by: Gaurang Patel on 2010-08-04 21:40:14
thanks for your help. it works
by: niuwei on 2010-07-01 04:42:18
TKS,Very useful script.I am using in my site.

by: Tanveer on 2010-06-24 08:56:50
Very useful script.I am using in my site
by: Mohammad Waheed on 2010-05-27 17:32:46
I love this. I'm using it in my blog.
by: Mohammad Waheed on 2010-05-27 17:31:50
I love this. Thank you so much. I am using this in my blog site. :)
by: Ky on 2010-04-19 09:08:52
Who is the genius? I wanna marry him!
by: hotel girl on 2010-04-12 18:43:25
Wow, this is awesome code. Im glad I got out of bed today!!!!
by: rh [admin]Site Admin on 2009-09-18 13:29:57
read here:
by: Tech on 2009-09-17 18:00:01
What is the php script that is used to feed the IP to the JavaScript?
by: kh again! on 2009-07-22 04:21:44
solved the firefox problem. I had to add an Id label to the text fields. I set the name and Id as the same.
<input name="ip" id="ip" size="75" type="hidden">
<script type="text/javascript">
document.getElementById("ip").value=VIH_HostIP; </script>

<input name="host" id="host" size="75" type="hidden">

by: kh on 2009-07-21 22:50:39
and lastly
Why does this not work in Firefox?
Any fixes to my code?

by: kh on 2009-07-21 22:38:19
noticed my second item was truncated. Here it is
name="host" size="75" type="text">
<script language="JavaScript">
document.getElementById("host").value=VIH_HostName; </script>

by: kh on 2009-07-21 22:30:57
Also - must include the original javascript in the body. Can be hidden.

For the html fields, change
type="text" to

if you want the fields to be invisible, but still be emailed to you.

by: kh on 2009-07-21 22:28:35
This works on IE 8.06001, not on Firefox 3.0.11

<input name="ip" size="75"
<script language="JavaScript">
document.getElementById("ip").value=VIH_HostIP; </script><input
name="host" size="75" type="text">
<script language="JavaScript">

by: kh on 2009-07-21 21:35:44
I think I got it. Will post the results later!
by: kh on 2009-07-21 19:52:19
I am trying to get the IP and Host into a html form field. I read what you said to Mary Tauber

But i need more info.
Where do I paste the above code?
Or is there another way to do it.

PS - live your script - at least I can see my own IP and Host - have looked for two days to get that far!

by: harish on 2009-06-04 08:01:04
this information is very helpful for me. I have <a href="">design a website</a>. This is very useful for me because I want to display the ip address of the visitors on the my website. so that this information is very helpful for me.
by: rh [admin]Site Admin on 2009-06-03 02:43:38
not possible. at least not with pure javascript. discovering user's ip is the realm of the server-side, ssi or server script.
by: AlexNY on 2009-06-02 13:20:37
is it possible to redirect the user based on his/her IP by javascript and HOW??
by: Vardant on 2009-06-01 03:39:29
I used it in my proxy site
by: Dragusha on 2009-05-28 11:10:08
I have used in my website
by: Russ on 2009-04-07 13:57:12
I like it - Thank you
by: Pieter on 2008-12-22 08:08:43
Any ideas on how I can get the IPv6 address instead of the IPv4 adress ?
by: Tony Nailz on 2008-09-15 14:54:35
is there any way that you can record the results to your database and deny access to those whos ip is on the list?

for example:
a visitor visits a specific page on my site, their ip gets recorded; and as long as it's on my database, they can't access the page with ip recorder on it.("just a thought")

BTW. this is a great code.. Kudos to you my friend...

by: Iswandi on 2008-09-01 05:56:36
You can see it in
by: Iswandi on 2008-09-01 05:52:49
Thanks man, I use your code and it works just as I desire
by: Hello, World on 2008-07-01 21:18:57
Whats this about??!!
by: Iswandi on 2008-06-28 06:21:33
I use a *.js file to support my html code. How can I put that code into the js file. I have removed the "<script language="Java....></script>", but not work.

by: mimi on 2008-06-10 06:16:35
is it possible to redirect the user if the hostname is "" by javascript??

I've tried
<script language="JavaScript">
if (VIH_DisplayFormat=="")
location= ""

it's not work..

by: Ravi on 2008-05-26 07:30:42
Hi Thanks for your excellent code!!!
I tried to assign Host Ip into a text box. It is coming, but I had to call your php file begining. but the thing is when I even used VIH_DisplayOnPage = no; IP & Host are Displaying.(as follows)

You are visiting from:
IP Address:
Can u please help me to hide those IP & Host lines.

by: rh [admin]Site Admin on 2008-05-15 03:38:58
that data is generally derived by running a whois on an ip. it generally resolves to isp's location, not an individual's address.
by: Webmaster Trainee on 2008-05-11 06:30:58
Is it possible to display IP Address and also the owner info? I saw once at a website a complte info like this: "Your IP Address is XXX.XX.XX.XX. Your location is "369 W Street, Big City, ANYWHERE. Anybody can help me. I am a webmaster's assistant and still leanr a lot. Thank you for your information.
by: kim on 2008-04-09 13:44:54
is there a way to figure out who an IP address belongs to? and does the ip address change if your logged onto a cell phone when you view a page?
by: hsw on 2008-03-16 02:21:52
are you serius?
IP address is threated as constants in your .js code, how come?

by: N.S. on 2008-02-29 22:05:11
<script language="JavaScript">
VIH_BackColor = "palegreen";
VIH_ForeColor = "navy";
VIH_FontPix = "16";
VIH_DisplayFormat = "You are visiting from:<br>IP Address: %%IP%%<br>Host: %%HOST%%";
VIH_DisplayOnPage = "yes";
<script language="JavaScript" src=""><

by: nightstalker on 2008-02-29 22:04:37
ugh it not wanting me 2 post it.
by: rh [admin]Site Admin on 2008-02-14 02:53:21
use javascript. e.g. if the id of the hidden field is "hfield" use this code:

by: Marv Tauber on 2008-02-13 18:47:30
How would I pass the contents of VIH_HostIP to a hidden text field
by: rh [admin]Site Admin on 2008-01-20 03:38:19
ellis, script has been modified to generate javascript variables and suppress the default message. look above for usage.

steve, the script requires server-side code to work. i have provided a link to a blog entry detailing the server-side work.

by: Steve on 2008-01-19 03:46:59
I've searched high and low for a script to identify visitors to my webpage, not to keep track, but to make visitors aware that they're not really completely anonymous. Nothing has actually worked except your script. I'd like to decrease the load on your server but would need your php src=""
but when I try to navigate there I get redirected to a sample usage page but n

by: Ellis on 2008-01-13 18:15:49
Is there a way the IP address can be extracted into a local javascript variable?
by: ayodeji on 2007-12-25 05:50:09
hi pls how do i get this code for use on my site
by: newt on 2007-12-20 12:41:16
How do i get the source file for this, script couse i will need t run everything from my server?
by: christian on 2007-12-12 09:44:26
very nice work.
i really searched baddly for a visitors ip address code.
yours is really deamn good.

now to my last question.
where can i add <align right> so that the text... is wrriten from the right to the left ?

i tried almost everything in:
VIH_DisplayFormat = "..."

but... nothing really works

by: rh [admin]Site Admin on 2007-11-19 02:37:05
wrap the last line of the script block in a <div> or <span> tag and style as desired.
by: jay on 2007-11-16 18:15:09
hey admin
i would like to change the font and i really need to!!! how can i do this?

by: rh [admin]Site Admin on 2007-08-20 02:15:59
as promised, IP address and Host name server-side scripting:


by: rh [admin]Site Admin on 2007-08-10 03:58:11
as some are still skeptical of the intentions of this site (no hard feelings), i will soon post new material on how the IP and host data can be retrieved using various server-side techniques. stay tuned.
by: David on 2007-08-09 14:19:19
Here's a good site with more detail of js's script:
Don't forget to add <?php before and ?> after.
No phone home with this one.

by: Bill on 2007-08-06 20:36:46
nice work! I know there is a way to do the following, but I have very limited knowledge of javascript, so thats why im asking: How can i log the user's IP and host hidden(ly)? After this I simply name the variables and identify them as well as the other information in my PHP mailto page. This would be very helpful, and I appreciate in advance any replies!
by: John collins on 2007-08-05 03:43:35
Very nice script. Works quite well.

J Collins

by: hamid on 2007-07-21 19:17:35
i want source code to find visitor ip address other website
example :
get visitor ip

by: gabor on 2007-07-05 15:04:01
sal pls ma ajuii sa fac un sever de cs.16 plss??:(
by: rh [admin]Site Admin on 2007-06-26 22:56:23
not so hard to figure that out. the script, coming
from, is in plain sight up above. and the php code is given just below your comment. no private info is transmitted, and i do nothing with the ip address. feel free to use this utility or call it ratty.

by: js on 2007-06-26 06:02:05
Kind of ratty the way this script phones home to your web site whenever it is used, eh?

BTW, to display the IP address using PHP without the text box, use:


by: rh [admin]Site Admin on 2007-06-16 16:35:26
tina, that's not easily done using this utility. but it's simple if you have access to ssi or scripting. e.g. if php is available, you would specify:
<input type="text" value="<?= $_SERVER['REMOTE_ADDR'] ?>">


by: Tina on 2007-06-13 05:14:04
hello, i just wondering if how can i get the %%IP%% or the %%HOST%% to be place in an input box?

<input type="text" value=%%IP%%>


by: Sanjeet on 2007-04-26 09:01:27
Yo man ! ya did a cool piece of work. Ya deserve every best wishes !!!
by: Hassan on 2006-10-10 01:21:04
Thanks alot friend. Your web site has been a pleasure to visit.Keep UP the good work.
Kheily mamnoon.

by: sacred0m on 2006-09-19 16:26:36
YOu fuckin rock Hashemian! Neat script worx great!

i like to let my visitors know their own info =)

by: rh [admin]Site Admin on 2006-09-15 01:43:28
the data is not logged anywhere. to see such information, you can ask your hosting vendor to provide you with a log of the visits, or you can try one of the several tracking utilities available online, such as google analytics.
by: one feather on 2006-09-09 02:23:27
This code shows the viewer "THEIR" own ip address, but does it log it somewhere so I can view who has visited? (for purposes of bandwidth/graphics stealing?)
by: Nitrogen on 2006-07-20 22:12:45
Is it possible to supply a simple js file with a variable string?
Example: <script src="jsfile.js?var=IPString"></script>

That script would then popup with my IP address, this would be great to keep users banned off my chatroom :) I would appreciate this, and your name would be mentioned on the frontpage.

by: rh [admin]Site Admin on 2006-04-05 02:09:26
new additions are in the plans, but that's it for now.
by: AlohaJoe on 2006-03-31 05:07:20
besides IP and Host what other items can be shown to the client? and then how to insert them? Ive tried Host_port but it does not show up. Newbie here :-)


by: AlohaJoe on 2006-03-31 05:02:18
besides IP and Host what other items can be shown to the client? and then how to insert them? Ive tried Host_port but it does not show up. Newbie here :-)


by: rh [admin]Site Admin on 2005-12-25 03:17:20
script has been updated to check for HTTP_X_FORWARDED_FOR first. if this value is not set then the actual ip is displayed. please note that some proxy servers may not supply this value for anonymity. in that case the ip address displayed is that of the proxy and not the original one.
by: rh [admin]Site Admin on 2005-11-11 04:38:12
%%IP%% indicates the address where a page is being accessed from. yes, that could be the address of a proxy server or a gateway/firewall. that is a valid request and i might consider enhancing this utility to display data from various headers such as the one requested.
by: Nyi Htut on 2005-10-24 09:49:39
I think %%IP%% is for proxy address.

How can i add X_Forward_Address insted of IP address?

Submit a comment:

Your Name:

Your E-mail: (Not shown. No notification is sent.)

Your Web Page URL:

Your Comment: (Max 450 chars, HTML tags are encoded for security.)
 characters left.
Type in the code :

Close window