diff options
| -rw-r--r-- | ip-detection/index.html | 28 | ||||
| -rw-r--r-- | ip-detection/js/main.js | 5 |
2 files changed, 33 insertions, 0 deletions
diff --git a/ip-detection/index.html b/ip-detection/index.html new file mode 100644 index 0000000..d21199c --- /dev/null +++ b/ip-detection/index.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html lang="en"> + + <head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta http-equiv="X-UA-Compatible" content="ie=edge"> + <title>s1nical - IP Detection</title> + <!-- CSS Links --> + <!-- External Libraries --> + <script src="http://code.jquery.com/jquery-1.9.1.js"></script> + <!-- Invisible Script Links --> + </head> + + <body> + <!-- Visable Script Links --> + <script src="/ip-detection/js/main.js"></script> + + <h3>Client side IP geolocation using <a href="http://ipinfo.io">ipinfo.io</a></h3> + + <hr /> + <div id="ip"></div> + <div id="address"></div> + <hr />Full response: + <pre id="details"></pre> + </body> + +</html>
\ No newline at end of file diff --git a/ip-detection/js/main.js b/ip-detection/js/main.js new file mode 100644 index 0000000..9f6c6ec --- /dev/null +++ b/ip-detection/js/main.js @@ -0,0 +1,5 @@ +$.get("http://ipinfo.io", function (response) { + $("#ip").html("IP: " + response.ip); + $("#address").html("Location: " + response.city + ", " + response.region); + $("#details").html(JSON.stringify(response, null, 4)); +}, "jsonp");
\ No newline at end of file |