我只是想用动态变化的地址(取自数据库)嵌入谷歌地图,但我想保留在 http.map 中。每次我尝试嵌入地图时,它都会加载,但会向控制台发送几个错误(同一错误的 60 多次迭代):
Unsafe JavaScript attempt to access frame with URL http://mydomain.com from frame with URL https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=address&z=14&output=embed.
The frame requesting access has a protocol of 'https', the frame being accessed has a protocol of 'http'. Protocols must match.
我该如何解决?我的 iframe 代码:
document.getElementById("deMap").src = 'http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q='+arr[5]+'&hnear='+arr[5]+'&z=14&output=embed';
相关HTML:
<div id="deRight">
<iframe id="deMap" width="405px" height="150px" style="background-color:rgba(0,0,0,.5)"></iframe><br>Contact Info:<br>
<div id="deContact"></div><br>
Additional Info.:<br>
<div id="deInfo"></div>
<div class="footer" style="width:410px">
<hr style="width:100%; height:1px; background-color: #CCC; border:0px; margin: 0px; margin-bottom:5px"/>
<button class="formBtn" onclick="editEvt()">Edit Event</button>
</div>
</div>