我正在尝试使用javascript从网络摄像头保存照片,但在google-chrome中出现此错误:
Access to XMLHttpRequest at 'file:///C:/directory/upload.php' from origin 'null' has
been blocked by CORS policy: Cross origin requests are only supported for protocol
schemes: http, data, chrome, chrome-extension, https.
我试图做:
Use cmd prompt to run
npm install http-server -g
to install a local server
(You need to have nodejs installed)
Then run
http-server -p8000
from your working folder.
Open browser with address http://localhost:8000
但是无法识别http服务器。
您知道什么方法可以消除此错误吗?