mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 15:10:49 +08:00
feat: disable webgl2 on safari
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user