jQuery$.从https站点获取http
jQuery $.get to http from https site
在我的网页上,我集成了一个foscam网络摄像头。它就像一个魅力,直到我把我的域从http切换到https。问题似乎是不允许您从https站点与非https站点进行通信(foscam只能通过http进行通信)。如果你从安全的角度考虑,这似乎是完全合理的,但我想知道是否有办法绕过
为了集成网络摄像头,我使用以下脚本:
<script language="JavaScript" type="text/javascript">
function reload()
{
setTimeout('reloadImg("refresh")',10)
};
function reloadImg(id)
{
var obj = document.getElementById(id);
var date = new Date();
obj.src = "http://www.somedomain.com/snapshot.cgi?user=username&pwd=mypw&t=" + Math.floor(date.getTime()/10);
}
@endif
</script>
和
<img src="http://www.somedomain.com/snapshot.cgi?user=username&pwd=mypw&t" name="refresh" id="refresh" onload='reload(this)' onerror='reload(this)'>
这仍然有效(尽管控制台确实显示了类似的错误
混合内容:位于"的页面https://www.somedomain.nl/webcam"通过HTTPS加载,但请求了不安全的映像"http://www.somedomain.nl/snapshot.cgi?user=user&pwd=通过&t=145244729934’。这些内容也应该通过HTTPS提供。
我遇到的真正问题是控制网络摄像头的按钮。为此,我使用如下代码:
$("#left").click(function(){
$.get( "http://www.somedomain.nl/decoder_control.cgi?command=6&user=username&pwd=pass&onestep=1",
function( data ) {});
});
这些按钮不再工作,并在控制台中生成以下错误:
混合内容:位于"的页面https://www.somedomain.nl/webcam"通过HTTPS加载,但请求了不安全的XMLHttpRequest终结点"http://www.somedomain.nl/decoder_control.cgi?command=2&user=someuser&pwd=通过&onestep=1'。此请求已被阻止;内容必须通过HTTPS.发送@jquery.js:8625jQuery.extend.ajax@jquery.js:8161jQuery
有办法解决这个问题吗?
也许您应该将http更改为https:
$("#left").click(function(){
$.get( "https://www.somedomain.nl/decoder_control.cgi?command=6&user=username&pwd=pass&onestep=1",
function( data ) {});
});
编辑:链接:
方法如何使用https访问:类型https://cameraip:https在浏览器中直接端口/登录摄像头。
但这个功能需要新的固件:
新固件支持HTTPS,它提高了您登录相机时的安全性。
- AngularJS:如何获取$http结果作为函数的返回值
- 在javascript中获取 http.post,然后发送响应
- 如何通过JavaScript获取HTTP协议版本
- 使用C++获取HTTP get参数
- AngularJS无法从PHP获取HTTP标头
- 尝试在火狐扩展中获取 HTTP POST 请求
- 获取 http://localhost//images/Products/ 403(禁止)
- 在节点.js中获取 http 状态代码
- jQuery$.从https站点获取http
- Chrome扩展-如何获取HTTP响应正文
- 如何通过JS|Jquery获取HTTP Referer
- AngularJS:如何获取$http的错误状态
- 如何获取HTTP get请求传递的客户端参数
- 在jquery中获取http状态代码
- 如何使用JS获取HTTP响应头
- 使用$q.all()从AngularJS中的函数获取$http数据
- AngularJS:从模块中的函数获取$http响应
- 在Node.js中使用restler获取HTTP响应
- 获取HTTP内容
- AngularJS:获取$http.在JSP中发布数据