Check out http://www.ipify.org/
According to them:
- You can use it without limit (even if you're doing millions of requests per minute).
- ipify is completely open source (check out the GitHub repository).
Here's a working JS example (instead of wondering why this answer has so few votes, try it yourself to see it in action):
<script>
function getIP(json) {
alert("My public IP address is: " + json.ip);
}
</script>
<script src="https://api.ipify.org?format=jsonp&callback=getIP"></script>
Too lazy to copy/paste? I like it. Here's a demo
Too lazy to click? :O
Note: Turn off Adblock Plus / uBlock & co before running the demo .. otherwise, it just won't work.
I have nothing to do with the IPify team. I just think it's ridiculously cool that someone would provide such a service for the general good.