DEV Community

vicky9812
vicky9812

Posted on

hey

I want to show my pages by country in javaScript I want to show my web pages in dubaie and frach and India so what do I need to do in code if I am in dubaie so I can only access the page for duabaie, not an india page I can not acess if I am in india so I can only access page in India, can any one help me to do a code in javascript please give me the code and example for it

Top comments (1)

Collapse
 
codeofrelevancy profile image
Code of Relevancy

When your page gets load (www.mypage.com), detect the country of visitor. Once the country is identified, redirect the user on country specific web page. such as www.mypage.com/india, www.mypage.com/dubai or www.mypage.com/france.

If the country is not identified, don't do anything and let the visitor on the same/default page (www.mypage.com)

How to detect the country?

ipapi.medium.com/ip-address-locati...
db-ip.com/tutorials/javascript-get...