https与http百度地图不显示问题

控制台报错

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

上线后查看代码引入截图

https与http百度地图不显示问题_第1张图片

网络请求报错

https与http百度地图不显示问题_第2张图片
这是因为线上是https协议与引入时的http协议导致

解决方法一 末尾加 &s=1

https://api.map.baidu.com/getscript?v=3.0&ak=你的密钥&s=1

解决方法二,自动将http协议提升为https


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

你可能感兴趣的:(工作记录,Bug记录,前端,笔记)