https中请求http资源报错Mixed Content

在改造网站https的时候,在不少页面发现如下警报:

Mixed Content: The page at ‘xxx’ was loaded over HTTPS, but requested an insecure resource ‘xxx’. This request has been blocked; the content must be served over HTTPS.

解决办法

页面的head中加入:

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

注意:只在需要的网页上加上面的语句,其它不需要的不要加,不然会出错的。

版权所有,转载注明外贸鲁夫 » https中请求http资源报错Mixed Content