forked from Ajaxy/telegram-tt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompatTest.js
25 lines (20 loc) · 927 Bytes
/
compatTest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function compatTest() {
var hasPromise = typeof Promise !== 'undefined';
var hasWebSockets = typeof WebSocket !== 'undefined';
var hasWebCrypto = window.crypto && typeof window.crypto.subtle !== 'undefined';
var hasObjectFromEntries = typeof Object.fromEntries !== 'undefined';
var isCompatible = hasPromise && hasWebSockets && hasWebCrypto && hasObjectFromEntries;
if (isCompatible || (window.localStorage && window.localStorage.getItem('tt-ignore-compat'))) {
window.isCompatTestPassed = true;
return;
}
if (window.console && console.warn) {
console.warn('Compatibility test report:');
console.warn('Promise', hasPromise);
console.warn('WebSocket', hasWebSockets);
console.warn('WebCrypto', hasWebCrypto);
console.warn('Object.fromEntries', hasObjectFromEntries);
}
document.body.innerHTML = '<iframe src="./unsupported.html" width="100%" height="100%">';
}
compatTest();