added "old browser" warning
This commit is contained in:
parent
8c622dfa38
commit
f210f51fc3
31
index.html
31
index.html
@ -661,9 +661,38 @@
|
|||||||
elem.innerHTML = innerHTML
|
elem.innerHTML = innerHTML
|
||||||
return elem
|
return elem
|
||||||
}
|
}
|
||||||
|
// detect browser version
|
||||||
|
function detectBrowser() {
|
||||||
|
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 'IE ' + (tem[1] || '');
|
||||||
|
}
|
||||||
|
if (M[1] === 'Chrome') {
|
||||||
|
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
|
||||||
|
if (tem != null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
|
||||||
|
}
|
||||||
|
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 M.join(' ');
|
||||||
|
}
|
||||||
window.addEventListener('hashchange', e => showPage(window.location.hash))
|
window.addEventListener('hashchange', e => showPage(window.location.hash))
|
||||||
window.addEventListener("load", () => {
|
window.addEventListener("load", () => {
|
||||||
|
const [browserName, browserVersion] = detectBrowser().split(' ');
|
||||||
|
const supportedVersions = {
|
||||||
|
Chrome: 85,
|
||||||
|
Firefox: 75,
|
||||||
|
Safari: 13,
|
||||||
|
}
|
||||||
|
if (browserName in supportedVersions) {
|
||||||
|
if (parseInt(browserVersion) < supportedVersions[browserName]) {
|
||||||
|
notify(`${browserName} ${browserVersion} is not fully supported, some features may not work properly. Please update to ${supportedVersions[browserName]} or higher.`, 'error')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
notify('Browser is not fully compatible, some features may not work. for best experience please use Chrome, Edge, Firefox or Safari', 'error')
|
||||||
|
}
|
||||||
document.body.classList.remove('hidden')
|
document.body.classList.remove('hidden')
|
||||||
document.querySelectorAll('sm-input[data-btc-address]').forEach(input => input.customValidation = btc_api.validateAddress)
|
document.querySelectorAll('sm-input[data-btc-address]').forEach(input => input.customValidation = btc_api.validateAddress)
|
||||||
document.addEventListener('keyup', (e) => {
|
document.addEventListener('keyup', (e) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user