mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-22 23:41:27 +00:00
24 lines
452 B
JavaScript
24 lines
452 B
JavaScript
/* eslint no-var: off */
|
|
/**
|
|
* detect if the browser is in UTF-8 zone
|
|
* @return boolean
|
|
*/
|
|
function isUTF8Zone() {
|
|
return new Date().getTimezoneOffset() === -480;
|
|
}
|
|
|
|
/**
|
|
* detect if the browser is already in a locale view
|
|
*/
|
|
function isInLocaleView() {
|
|
return /(cn|en)/i.test(location.href);
|
|
}
|
|
|
|
function initDefaultLocaleAndStatic() {
|
|
if (!isInLocaleView()) {
|
|
location.href = isUTF8Zone() ? '/cn' : 'en';
|
|
}
|
|
}
|
|
|
|
initDefaultLocaleAndStatic();
|