发布时间:2020-12-28 11:45:00
让百度地图api支持在https显示的方法
1、首页到百度:http://api.map.baidu.com/lbsapi/creatmap/index.html 获取代码
2、百度地图api默认是使用在http协议下,现在很多网站都使用了https证书,那百度地图调用时也要改一下api的协议,把获得的代码中的:

改成:
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=您的密钥&s=1">
&=1是必须要有的3、秘钥需要自己到百度api官网 http://lbsyun.baidu.com/ 申请一个



使用方法有两个:
1、直接把代码粘贴到要显示的地方2、把代码保存成一个html文件,如:map.html ,再上传到你的网站根目录,引用到网站上,引用代码如下:
<iframe frameborder="0" height="600px" scrolling="no" src="https://www.自已的域名.com/map.html" width="100%"></iframe>
上一篇: 实现网站保存在电脑桌面的快捷方法
下一篇: 升级为https协议后,原http的js/css/jpg资源无法打开的解决方法