function isMobile() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}
function checkBrowser() {
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/edge\/([\d.]+)/))
? (Sys.edge = parseInt(s[1]))
: (s = ua.match(/rv:([\d.]+)\) like gecko/))
? (Sys.ie = parseInt(s[1]))
: (s = ua.match(/msie ([\d.]+)/))
? (Sys.ie = parseInt(s[1]))
: (s = ua.match(/firefox\/([\d.]+)/))
? (Sys.firefox = parseInt(s[1]))
: (s = ua.match(/chrome\/([\d.]+)/))
? (Sys.chrome = parseInt(s[1]))
: (s = ua.match(/opera.([\d.]+)/))
? (Sys.opera = parseInt(s[1]))
: (s = ua.match(/version\/([\d.]+).*safari/))
? (Sys.safari = parseInt(s[1]))
: 0;
return Sys;
}
function showBrowserTips(text) {
window.onload = function (e) {
var mainEle = document.getElementById('root');
var div = document.createElement('div');
div.innerText = text;
div.style =
'width: 100%; height: 30px; line-height: 30px; text-align: center; background-color: #fff7e8; color: #1d2129;';
document.body.insertBefore(div, mainEle);
};
}
function init() {
var lang = localStorage.getItem('i18nextLocale');
var sys = checkBrowser();
var browserTipsText =
lang === 'en-US'
? 'The browser you are using may not be able to access this application normally. It is recommended to use the Chrome 49 +/Safari 11 +/Firefox 44 + browser to open this application for the best experience.'
: '您使用的瀏覽器可能不能正常訪問本應用,推薦使用 Chrome 49+ / Safari 11 + / Firefox 44+ 瀏覽器打開本應用🍯,獲得最佳體驗';
var phoneTipsText =
lang === 'en-US'
? 'This application does not support opening on the mobile, please use the pc browser to open it'
: '本應用暫不支持移動端打開,請使用 pc 瀏覽器打開';
if (sys.ie) {
showBrowserTips(browserTipsText);
}
}
init();