Created
September 16, 2016 16:02
-
-
Save alvises/0e57d9762f013b41b6116e03a2d1eef7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<HTML> | |
<head> | |
<title>GeoIP test</title> | |
<script src="http://geoip.poeticoding.com/geoip.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<div id="details">Loading...</div> | |
</body> | |
<script> | |
var geoip = new GeoIP(); | |
geoip.locate(function(ip,location){ | |
var details = document.getElementById("details") | |
var html = "<h1>IP: "+ip+"</h1>"; | |
if(location) | |
html += "<h1>Location: "+location.country_name+", "+location.city_name+"</h1>"; | |
details.innerHTML = html; | |
}) | |
</script> | |
</HTML> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment