怎么解决https网站访问http文件报错?

https的网站访问一些http的文件时,比如html中直接在线使用一些三方库时,会报文件地址被blocked

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

我们只需要在html的<head></head>中加入一行代码即可解决:

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

本文为@艺文笔记原创文章,转载请注明出处:https://www.xuwenyan.com/archives/1516,非常感谢!
上一篇:  下一篇: