谷歌浏览器:This request has been blocked; the content must be served over HTTPS.

最近是做百度小程序的时候,使用百度api_debug工具调试接口的时,出现了下面的报错:

xhr.js:172 Mixed Content: The page at 'https://open.baidu.com/static/newopen/api_debug/' 
was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 
'http://forge.speedtest.cn/api/v2/baidu/deal'. This request has been blocked; the content
 must be served over HTTPS.

如下所示:
谷歌浏览器:This request has been blocked; the content must be served over HTTPS._第1张图片

出现该问题的原因是:在https里面请求了http链接。在网上找了下,发现大多都是在代码层面进行处理,没有说明在谷歌浏览器下如何处理。研究了下,终于找到了解决办法:


一 选择浏览器左上:

谷歌浏览器:This request has been blocked; the content must be served over HTTPS._第2张图片
谷歌浏览器:This request has been blocked; the content must be served over HTTPS._第3张图片

二 进入设置页面

谷歌浏览器:This request has been blocked; the content must be served over HTTPS._第4张图片
针对不安全内容选项,选择允许:

谷歌浏览器:This request has been blocked; the content must be served over HTTPS._第5张图片


三 重新刷新页面

刷新前:

谷歌浏览器:This request has been blocked; the content must be served over HTTPS._第6张图片
刷新后:

谷歌浏览器:This request has been blocked; the content must be served over HTTPS._第7张图片

此时接口可以正常请求了

你可能感兴趣的:(工具使用,工具使用心得,谷歌浏览器,chrome,https,http)