Home >Web Front-end >HTML Tutorial >Can we remove the 'getContext' attribute of HTML5 Canvas tag through script?
It is not stated in the HTML5 specification that it is valid for scripts to delete the getContext attribute.
We can write a piece of code that removes the getContext property of HTMLCanvasElement and then in a separate statement we set it to undefined.
Delete window.HTMLCanvasElement.prototype.getContext; _assertSame(window.HTMLCanvasElement.prototype.getContext, undefined, "window.HTMLCanvasElement.prototype.getContext", "undefined");
The above is the detailed content of Can we remove the 'getContext' attribute of HTML5 Canvas tag through script?. For more information, please follow other related articles on the PHP Chinese website!