Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <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>
- function myIP() {
- if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
- else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- xmlhttp.open("GET","http://api.hostip.info/get_html.php",false);
- xmlhttp.send();
- hostipInfo = xmlhttp.responseText.split("n");
- for (i=0; hostipInfo.length >= i; i++) {
- ipAddress = hostipInfo[i].split(":");
- if ( ipAddress[0] == "IP" ) return ipAddress[1];
- }
- return false;
- }
- <div style="display:none;visibility:hidden" id="uip"><%= Request.UserHostAddress %></div>
- var ip = $get("uip").innerHTML;
Add Comment
Please, Sign In to add comment