peer.js is not working http but not on https?

こ雲淡風輕ζ 提交于 2019-12-10 11:38:43

问题


when i used this http://cdnjs.cloudflare.com/ajax/libs/peerjs/0.3.14/peer.js its was giving following error

was loaded over HTTPS, but requested an insecure script 'http://cdnjs.cloudflare.com/ajax/libs/peerjs/0.3.14/peer.js'. This request has been blocked; the content must be served over HTTPS.

after adding https://cdnjs.cloudflare.com/ajax/libs/peerjs/0.3.14/peer.js its started giving

was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint '0.peerjs.com:9000/c03lztxhq78vkj4i/…;. This request has been blocked; the content must be served over HTTPS.


回答1:


check its compatability support of peerjs http://peerjs.com/status/old




回答2:


This is due to mixed-content blocking - try loading the secure version e.g.

https://cdnjs.cloudflare.com/ajax/libs/peerjs/0.3.14/peer.js



回答3:


Might be late but anyways this might help some ...

In case of Peer Js :

If you’re planning to deploy to a remote server, it has to be via HTTPS. This is because browsers only allows to access device if connection is secure.

This article might help ( Read under the title: Deploying to remote server ).

If curious, also consider having a look at web fundamentals. ( Read under the title : An XMLHttpRequest example ).

Extra stuff : You can also read this documentation to prevent mixed content.



来源:https://stackoverflow.com/questions/34526740/peer-js-is-not-working-http-but-not-on-https

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