Chrome doesn't treat insecure origin as secure despite flag

对着背影说爱祢 提交于 2019-12-02 04:51:01

问题


I want to test getUserMedia on an insecure origin on Chrome on Windows. I am starting Chrome in this way as instructed on goo.gl/rStTGz, a link that shows up in the console if you use insecure origin with getUserMedia:

start chrome "http://my-ip:8000/index.html" --unsafely-treat-insecure-origin-as-secure="http://my-ip" --user-data-dir=/tmp

In index.html there is this:

navigator.getUserMedia({ audio: true, video: { width: 1280, height: 720 } }, stream => console.debug(stream), e => console.error(e))

It still gives me error even though I did what the first link said. This error includes another link goo.gl/Y0ZkNV which doesn't mention how to work around this for testing at all.

Is this still supported? It would seem so, because Chrome indeed did start with a fresh profile and shows a warning about using the aforementioned flag. The flag is obviously read by Chrome, but not acted upon. Why?


回答1:


You need to specify the port in the flag as well. Try

start chrome "http://my-ip:8000/index.html" --unsafely-treat-insecure-origin-as-secure="http://my-ip:8000" --user-data-dir=/tmp

Note that --user-data-dir is no longer required. See the note in point #3 here.



来源:https://stackoverflow.com/questions/40032182/chrome-doesnt-treat-insecure-origin-as-secure-despite-flag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!