Comment: I have collected and sorted out some usage methods for determining whether the browser supports canvas. Interested friends can learn about it.
To determine whether the browser supports canvas, the specific code is as follows:<!DOCTYPE html>
<head>
<meta charset=utf-8 />
<title>canvas</title>
<script type='text/javascript'>
window.onload = function(){
/**Just determine whether the browser supports canvas**/
try{
document.createElement('canvas').getContext('2d');
var addDiv = document.createElement('div');
addDiv.innerHTML='Canvas supported';
document.body.appendChild(addDiv);
}catch(e){
var addDiv = document.createElement('div');
addDiv.innerHTML='The browser does not support canvas';
document.body.appendChild(addDiv);
}
};
</script>
</head>
<body>
</body>
</html>