当前位置:   article > 正文

网页访问报错This request has been blocked; the content must be served over HTTPS._钉钉扫码登录 this request has been blocked; the content

钉钉扫码登录 this request has been blocked; the content must be served over

问题:网页有时访问https网站,由于网站中一些资源是http的,网页执行会报错“This request has been blocked;  the content must be served over HTTPS.”,chrome浏览器审查元素可以看到。

解决:

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

可以在相应的页面的<head>里加上这句代码,意思是自动将http的不安全请求升级为https

可以在代码中判断服务器的协议类型是否为https,再加载上述代码,如下

  1. {yun:}if strpos($config.sy_weburl,'https')!== false{/yun}
  2. <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
  3. {yun:}/if{/yun}

参考:https://segmentfault.com/q/1010000005872734

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/448996
推荐阅读
相关标签
  

闽ICP备14008679号