How to find IP Address using Javascript?
I'm using an external tool to find the Ip address through javascript.If you want you can use this
<html>
<head>
<title>What Is Your Ip</title>
<script language="JavaScript">
<!--
var ip_list = {};
function FoundIp(ip, type) {
// type: 4=ipv4 6=ipv6 0=unknown (autodetect)
if (type == 0) {
type = 4;
if (ip.indexOf(':') != -1) type = 6;
}
ip_list[ip] = type;
}
function MyIpIs() {
for(ip in ip_list) {
document.getElementById('myIp').innerHTML = ip;
}
}
// -->
</script>
<script language="JavaScript" src="http://only-ip4.wimip.fr/ip.php"></script>
</head>
<body onload="MyIpIs();">
<span>Your IP Address Is:</span>
<span id="myIp"></span>
</body>
</html>
<head>
<title>What Is Your Ip</title>
<script language="JavaScript">
<!--
var ip_list = {};
function FoundIp(ip, type) {
// type: 4=ipv4 6=ipv6 0=unknown (autodetect)
if (type == 0) {
type = 4;
if (ip.indexOf(':') != -1) type = 6;
}
ip_list[ip] = type;
}
function MyIpIs() {
for(ip in ip_list) {
document.getElementById('myIp').innerHTML = ip;
}
}
// -->
</script>
<script language="JavaScript" src="http://only-ip4.wimip.fr/ip.php"></script>
</head>
<body onload="MyIpIs();">
<span>Your IP Address Is:</span>
<span id="myIp"></span>
</body>
</html>
Online Demo:
In this example I'm using an external tool to find the Ip address through javascript.If you want you can use this
Your IP Address Is:
3 comments:
this is awesome.. any chance I can get the ip.php file for my own personal server. It is for my own usage and no one elses.
Thanks!
This one give you more option. http://www.easyjquery.com/api/1-detect-client-visitors-ip-country-city-javascript-jquery-php.html
I do used you code but I modified it to be used in silverlight. Can't I do that?
Post a Comment
Share your thoughts here...