Javascript geolocation in 2 lines for your webpage / prototypes

This a great piece of javascript to get geolocation infos in your web page. It’s perfect for small websites and prototypes.

Continent geolocation, country code, country name, currency in javascript

I used it in one of my project where we did our user testing in UK but the client is based in New Zealand. Implementing a easy system in 2 minutes was better than having two versions of the prototypes to maintain.

Simple, quick implementation

Import the page (http://www.geoplugin.net/javascript.gp), call the function you need and that’s it!
Documentation: http://www.geoplugin.com/webservices/javascript


var currency = geoplugin_currencySymbol_UTF8();

if(currency != "£") {
    document.body.innerHTML = document.body.innerHTML.replace(/£/g, currency);

– The scripts needs to be embedded in web pages – no server-side calls will work
– Lookups totalling more than 120 per minute will result in temporary (1 hour) blacklisting, during which time you will only receive a “403 Forbidden” response.
– Having no more than daily visit rate superior than 100,000 visitors per day

You can also implement it in PHP, JSON, XML, ASP.

Hope that helps!

Leave a Reply

Notify of