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:

  1. grab ip of current user
  2. look location in geolite database through server endpoint
  3. 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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -