Reputation: 3848
Safari 15 on macOS, iPhone and iPad will crash while rendering with canvas. Any solution for this? This used to work on the previous Safari.
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script language="javascript">
function init2() {
const canvas = document.createElement("canvas");
canvas.style.width = "800px";
canvas.style.height = "600px";
canvas.width = 1600;
canvas.height = 1200;
document.body.appendChild(canvas);
var ctx = canvas.getContext('2d');
ctx.font = '48px system-ui';
ctx.fillText('Hello World, 你好中文', 10, 50);
}
</script>
</head>
<body onload="init2()">
</body>
</html>
Upvotes: 1
Views: 841
Reputation: 3848
Finally, the solution for me is to replace the font "system-ui" to "san-serif" which fixed my issue. Also, in Safari Technical Preview and Beta 3 has already fixed this bug and schedule to release later in Oct. 2021.
Upvotes: 1