feat: disable webgl2 on safari

This commit is contained in:
Simon Ding
2024-07-26 23:26:14 +08:00
parent a997726a5f
commit 61bc9b72bd

View File

@@ -34,5 +34,25 @@
</head>
<body>
<script src="flutter_bootstrap.js" async></script>
<script>
if (
navigator.userAgent.indexOf("Safari") !== -1 &&
navigator.userAgent.indexOf("Chrome") === -1
) {
var originalGetContext = HTMLCanvasElement.prototype.getContext;
HTMLCanvasElement.prototype.getContext = function () {
var contextType = arguments[0];
if (contextType === "webgl2") {
return;
}
return originalGetContext.apply(
this,
[contextType].concat(Array.prototype.slice.call(arguments, 1)),
);
};
}
</script>
</body>
</html>