Chrome MJPEG CORS“无效响应”当img.crossOrigin =“匿名” [英] Chrome MJPEG CORS "invalid response" when img.crossOrigin="Anonymous"

查看:583
本文介绍了Chrome MJPEG CORS“无效响应”当img.crossOrigin =“匿名”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来源http://192.168.1.67:5555的图片已被跨源资源共享政策阻止加载:响应无效。因此,不允许访问原始http://127.0.0.1:8000。

我需要允许此MJPEG流的交叉因为用户必须能够使用按钮捕获图像,并且没有CORS画布被污染。

I need to allow cross origin for this MJPEG stream as the user must be able to capture the image with a button and without CORS the canvas is tainted.

我在FF和Chrome中遇到这个问题不同的视频源,因为它不支持MJPEG)。

I'm struggling with this issue in FF and Chrome (IE uses a different video source as it doesn't support MJPEG).

我的服务器还返回 Access-Control-Allow-Origin: code>。在设置 img.crossOrigin =Anonymous; 之后,在Javascript中设置图像 src >。
如果我删除 crossOrigin =Anonymous,流载入,但我得到了污染的画布错误。

My server also returns the Access-Control-Allow-Origin: * when serving the page. The image src is being set in Javascript (if that could be related) after setting img.crossOrigin = "Anonymous";. If i remove the crossOrigin="Anonymous", the stream loads but i get the tainted canvas error.

感谢
编辑:从wireshark,MJPEG请求:

Thanks edit: from wireshark, the MJPEG request:

GET / 2d HTTP / 1.1
主机: 192.168.1.67:5555
连接:keep-alive
接受:image / webp,image / *,* / *; q = 0.8
原产地:http://127.0.0.1:8000
User-Agent:Mozilla / 5.0(Macintosh; Intel Mac OS X 10_10_5)AppleWebKit / 537.36(KHTML,like Gecko)Chrome / 48.0.2564.109 Safari / 537.36
Referer:http://127.0.0.1 :8000 /
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en; q = 0.8,it; q = 0.6,pt; q = 0.4

HTTP / 1.0 200 OK
访问控制允许原产地:*
访问控制允许-Methods:GET
Access-Control-Allow-Headers:Content-Type
Content-Type:multipart / x-mixed-replace; border = - myboundary

推荐答案

使用此命令运行Chrome chrome .exe --disable-web-security 应该摆脱跨源的问题

run your chrome with this command chrome.exe --disable-web-security should get rid of the cross-origin problems

我有一个chrome快捷方式,这是目标

I have a chrome shortcut and this is the target for it:

C:\Program Files(x86)\Google\Chrome\Application\chrome.exe -disable-web-security

这篇关于Chrome MJPEG CORS“无效响应”当img.crossOrigin =“匿名”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆