错误: Mixed Content: The page at ‘https://xxxx’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://whois.pconline.com.cn/ipJson.jsp?ip=101.204.149.167&json=true’. This request has been blocked; the content must be served over HTTPS.
解决办法:
报错的的原因:查资料后发现原因是在https中请求http接口或引入http资源都会被直接blocked(阻止),浏览器默认此行为不安全,会拦截。
解决办法如下:(在index.html的head中加入以下代码)
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
加入该标签的原理是使用META标签强制将http请求转成https(SSL协议)请求