Reputation: 5
I am coding to change language by using Read with Korea Language
http://www.domain.com/EN/index.php
http://www.domain.com/KO/index.php
I mean that I just want to replace EN to KO then reload page again.
Appreciate for your help.
Upvotes: 0
Views: 3494
Reputation: 363
If you want to load region specific URL check IP filtering for geological locations. Depending upon IP you'll get, load corresponding URL. e.g. You can use :
if(ip address coming from <region>)
window.location.replace("http://www.domain.com/<region>/index.php");
Upvotes: 0
Reputation: 102753
Use the window.location object to get to the new URL:
window.location = window.location.protocol + "//"
+ window.location.host + window.location.pathname.replace("EN", "KO");
Or I guess simpler, just:
window.location = window.location.href.replace("/EN/", "/KO/");
Upvotes: 1
Reputation: 160843
If you reload the page, why not just use normal a href.
<a href="http://www.domain.com/KO/index.php">KO</a>
Upvotes: 5