MenuLa course
var geolocApiUrl = 'https://pro.ip-api.com/json/?key=RmV5lsoBtWFquJf';
function getCookie(c_name)
if (document.cookie.length > 0)
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1)
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1)
c_end = document.cookie.length;
return unescape(document.cookie.substring(c_start, c_end));
return "";
var lang = document.getElementsByTagName('html')[0].getAttribute('lang');
if (!getCookie('_landing'))
document.location.href = document.location.origin + '/' + lang + '/landing-page';
// geoloc
var getJSON = function(url, successHandler, errorHandler)
var xhr = typeof XMLHttpRequest != 'undefined'
? new XMLHttpRequest()
: new ActiveXObject('Microsoft.XMLHTTP');
xhr.open('get', url, true);
xhr.onreadystatechange = function()
var status;
var data;
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-readystate
if (xhr.readyState == 4) // `DONE`
status = xhr.status;
if (status == 200)
data = JSON.parse(xhr.responseText);
successHandler && successHandler(data);
else
errorHandler && errorHandler(status);
;
xhr.send();
;
getJSON(geolocApiUrl, function(data)
if (data.countryCode == 'JP')
if (!getCookie('jsport'))
//document.location.href = document.location.origin + '/landing'
, function(status)
console.log('Something went wrong');
);
function getCookie(c_name)
if (document.cookie.length > 0)
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1)
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1)
c_end = document.cookie.length;
return unescape(document.cookie.substring(c_start, c_end));
return "";
var lang = document.getElementsByTagName('html')[0].getAttribute('lang');
if (!getCookie('_landing'))
document.location.href = document.location.origin + '/' + lang + '/landing-page';
// geoloc
var getJSON = function(url, successHandler, errorHandler)
var xhr = typeof XMLHttpRequest != 'undefined'
? new XMLHttpRequest()
: new ActiveXObject('Microsoft.XMLHTTP');
xhr.open('get', url, true);
xhr.onreadystatechange = function()
var status;
var data;
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-readystate
if (xhr.readyState == 4) // `DONE`
status = xhr.status;
if (status == 200)
data = JSON.parse(xhr.responseText);
successHandler && successHandler(data);
else
errorHandler && errorHandler(status);
;
xhr.send();
;
getJSON(geolocApiUrl, function(data)
if (data.countryCode == 'JP')
if (!getCookie('jsport'))
//document.location.href = document.location.origin + '/landing'
, function(status)
console.log('Something went wrong');
);