我在非服务器模式下运行了一个获取图片像素数据的函数。报错。
报错为the operation is insecure.
解决思路为:打开服务器,将运行由:file:///D:/wamp64/www/js_programme/canvas_pixel.html
改为:http://localhost/js_programme/canvas_pixel.html
问题解决,结果图片:
下面放上自己的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Canvas-像素操作</title>
</head>
<body>
<canvas id="canvas" width="300" height="227"></canvas>
<canvas id="canvas2" width