General: Fix compatibility on old browsers (#3186)
This commit is contained in:
parent
233fff7eb5
commit
227f706a0c
@ -2,6 +2,18 @@
|
||||
<html style="height: 100%">
|
||||
<head>
|
||||
<title>Unsupported browser</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
</style>
|
||||
<!--[if IE]>
|
||||
<style>
|
||||
.hide-for-ie {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body style="height: 100%; margin: 0;">
|
||||
<table style="width: 100%; height: 100%; border-collapse: collapse;">
|
||||
@ -9,10 +21,18 @@
|
||||
<td style="vertical-align: middle; text-align: center;">
|
||||
<div style="display: inline-block;">
|
||||
<img src="./unsupported.png">
|
||||
<h3>Your browser is not supported. Please, update it or use our <a href="http://telegram.org/dl" target="_blank">native clients</a></h3>
|
||||
<h3>Your browser is not supported</h3>
|
||||
<p>Please, update it or use our <a href="http://telegram.org/dl" target="_blank">native clients</a>.</p>
|
||||
<a class="hide-for-ie" onclick="forceLoad()" href="#">I'm Feeling Lucky</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
function forceLoad() {
|
||||
window.localStorage.setItem('tt-ignore-compat', true);
|
||||
window.top.location.reload();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -25,7 +25,9 @@ import {
|
||||
TMP_CHAT_ID,
|
||||
MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES,
|
||||
} from '../../config';
|
||||
import { IS_ANDROID, IS_IOS, MASK_IMAGE_DISABLED } from '../../util/windowEnvironment';
|
||||
import {
|
||||
IS_ANDROID, IS_IOS, IS_TRANSLATION_SUPPORTED, MASK_IMAGE_DISABLED,
|
||||
} from '../../util/windowEnvironment';
|
||||
import { DropAreaState } from './composer/DropArea';
|
||||
import {
|
||||
selectCanAnimateInterface,
|
||||
@ -608,7 +610,7 @@ function MiddleColumn({
|
||||
/>
|
||||
<SeenByModal isOpen={isSeenByModalOpen} />
|
||||
<ReactorListModal isOpen={isReactorListModalOpen} />
|
||||
<MessageLanguageModal isOpen={isMessageLanguageModalOpen} />
|
||||
{IS_TRANSLATION_SUPPORTED && <MessageLanguageModal isOpen={isMessageLanguageModalOpen} />}
|
||||
</div>
|
||||
</Transition>
|
||||
|
||||
|
||||
@ -77,16 +77,18 @@
|
||||
|
||||
var isCompatible = hasPromise && hasWebSockets && hasWebCrypto && hasObjectFromEntries;
|
||||
|
||||
if (isCompatible) {
|
||||
if (isCompatible || (window.localStorage && window.localStorage.getItem('tt-ignore-compat'))) {
|
||||
window.isCompatTestPassed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
console.warn('Compatibility test report:');
|
||||
console.warn('Promise', hasPromise);
|
||||
console.warn('WebSocket', hasWebSockets);
|
||||
console.warn('WebCrypto', hasWebCrypto);
|
||||
console.warn('Object.fromEntries', hasObjectFromEntries);
|
||||
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%">';
|
||||
}
|
||||
|
||||
@ -60,6 +60,7 @@ export function setHandler(handler?: ErrorHandler) {
|
||||
function setupLayoutDetectors() {
|
||||
Object.entries(LAYOUT_CAUSES).forEach(([name, causes]) => {
|
||||
const entity = window[name as Entities];
|
||||
if (!entity) return;
|
||||
const prototype = typeof entity === 'object' ? entity : entity.prototype;
|
||||
|
||||
if ('props' in causes) {
|
||||
@ -100,6 +101,7 @@ function setupLayoutDetectors() {
|
||||
function clearLayoutDetectors() {
|
||||
Object.entries(LAYOUT_CAUSES).forEach(([name, causes]) => {
|
||||
const entity = window[name as Entities];
|
||||
if (!entity) return;
|
||||
const prototype = typeof entity === 'object' ? entity : entity.prototype;
|
||||
|
||||
if ('props' in causes) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user