HTTP 和 HTTPS 交叉使用跨域(Mixed Content)问题解决方法
今天在测试一段php代码时出现如下错误:Mixed Content: The page at 'https://www.wgbcw.com/……
' was loaded over HTTPS, but requested an insecure resource 'http://……
'. This request has been blocked; the content must be served over HTTPS.以前从未接触过,最近在写个小程序时出现了。所以上网搜索的结果就是群里曾经提过的跨域问题,而今天我这测试的结果加上这段代码就可以解决……
先测试代码:
echo "<meta http-equiv='Content-Security-Policy' content='upgrade-insecure-requests'>";
测试后没提示“Mixed Content:” ,另又加上<head></head>也正常
echo "<head><meta http-equiv='Content-Security-Policy' content='upgrade-insecure-requests'></head>";
不断努力学习,加油……
页:
[1]