我们可以通过脚本删除 HTML5 Canvas 标签的"getContext"属性吗?
htmlweb developmentfront end technology更新于 2026/1/18 10:52:17
HTML5 规范中没有说明通过脚本删除 getContext 属性是合法的。
我们可以编写一段代码,删除 HTMLCanvasElement 的 getContext 属性,然后在单独的语句中将其设置为 undefined。
Delete window.HTMLCanvasElement.prototype.getContext; _assertSame(window.HTMLCanvasElement.prototype.getContext, undefined, "window.HTMLCanvasElement.prototype.getContext", "undefined");
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

