javascript - Detect Country then show message? -
i have , uk website. if user uk, , on website, show message on page redirect correct site. how can this?
you can ip in geo database, such geolite (http://dev.maxmind.com/geoip/legacy/geolite), figure out user located.
geolite databases can downloaded app. create small server endpoint make ip lookups in database.
using javascript can then:
- grab ip of current user
- look location in geolite database through server endpoint
- if in uk on site (or vice versa) -> display message , optionally redirect user correct website
of course server-side, , automatically redirect user if that's preferred approach.
Comments
Post a Comment