Browser User Agent Check + Warning

This commit is contained in:
Smidy13 committed 2021-04-06 14:40:00 +12:00
1 parent 2bc7f91641
commit 8e2172afd3
1 file changed
+24
+24
View File
@@ -40,11 +40,35 @@ function loadSuperalgos() {
const MODULE_NAME = "App Pre-Loader";
const INFO_LOG = false;
let browser = checkBrowserVersion();
setupHTMLTextArea()
setupHTMLInput()
setupHTMLCanvas()
loadDebugModule()
if ((browser.name !== "Chrome" && browser.name!=="Safari") || (browser.name === "Chrome" && parseInt(browser.version) < 85) || (browser.name === "Safari" && parseInt(browser.version) < 13)) {
alert("Superalgos is officially supported on Google Chrome 85 or Safari 13.1 and above. Your browser version has been detected as potentially beneath this. If you continue you may experience some functionaility issues.\n\nDetected Browser: " + browser.name + "\nVersion: " + browser.version);
}
function checkBrowserVersion () {
let ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem=/\brv[ :]+(\d+)/g.exec(ua) || [];
return {name:'IE',version:(tem[1]||'')};
}
if(M[1]==='Chrome'){
tem=ua.match(/\bOPR|Edge\/(\d+)/)
if(tem!=null) {return {name:'Opera', version:tem[1]};}
}
M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1]);}
return {
name: M[0],
version: M[1]
};
}
function setupHTMLTextArea() {
let textArea = document.createElement('textarea');
textArea.id = "textArea";