Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: HTML
how i publish a html coded website which shows the browsing user ip address like "you are browsing from x.x.x.x (client ip)"
Posted 21-Nov-12 13:46pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

<script type="text/javascript" language="javascript">
<!--
function GetLocalIPAddress()
{
var obj = null;
var rslt = "";
try
{
obj = new ActiveXObject("rcbdyctl.Setting");
rslt = obj.GetIPAddress;
obj = null;
}
catch(e)
{

}

return rslt;
}
document.write("you are browsing from:" + GetLocalIPAddress());
//-->
</script>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

You can, relaying it via server side with JSONP
<script type="application/javascript">
    function getip(json){
      alert(json.ip); // alerts the ip address
    }
</script>
 
<script type="application/javascript" src="http://jsonip.appspot.com/?callback=getip"></script>
 
Or you can use the online services provided by websites, such as link[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 344
1 Nirav Prabtani 252
2 Abhinav S 220
3 Dave Kreskowiak 155
4 Pikoh 140
0 OriginalGriff 7,545
1 Sergey Alexandrovich Kryukov 6,757
2 Maciej Los 3,909
3 Peter Leow 3,693
4 CHill60 2,712


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 18 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100