在我的网站(https 安全)中使用谷歌地图显示错误
我的网站使用 https 安全页面,但是当我使用 Google 地图 API 在我的网站中引入地图时,它显示错误(例如网页包含不安全的项目)。但是如果我删除此 Gmap api,错误就会消失。
有什么方法可以让我在 https 安全页面中使用谷歌地图而不会出现任何这样的错误。
My website uses https secure pages, but when I use Google map API to bring in a map inside my website, it shows error (like webpage contains insecure items).But if I removed this Gmap api the error is gone.
Is there any way like I can use google map in https secured pages without any errors like this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,
查看 Google 的官方公告:
http://googlegeodevelopers.blogspot.com/2011/03/maps-apis-over-ssl-now-available-to-all.html
Yes,
Check out this official announcement from Google:
http://googlegeodevelopers.blogspot.com/2011/03/maps-apis-over-ssl-now-available-to-all.html
坏消息是,如果您使用 Google 地图 - SSL API,您有时仍会遇到安全和不安全的情况警报。原因如下:
上面的 Google url 显示 https:// 下的所有内容,以正确显示安全环境。 但是,这是一个巨大的问题,Google 现在会在左侧显示建筑物或位置的图片不带 https,从而为我们提供<我们讨厌在安全环境中出现不安全的错误。
这是一个很好的例子...看看以下内容:
https://maps-api-ssl.google.com/maps?q=1000+Ballpark+Way,+阿灵顿,+TX&hl=en&sll=37.0625,-95.67 7068&sspn=49.310476,101.425781&vpsrc=0&hnear=1000+棒球场+Way,+阿灵顿,+德克萨斯州+76011&t=m&z=17
现在使用 Firefox 或您选择的浏览器,右键单击建筑图像信息或图像属性... 哇!您会发现这张图片导致了不安全错误,因为根据 Google 的规定,所有内容都应该在 Google https:// 后面受到保护
建筑物和位置图片未在 https:// 下列出....您仍然会收到错误!
亲自检查一下,您就会看到我所看到的...因此,查看 SSL 背后的 Google 地图仍然是一个问题,除非有人知道一项工作-一轮以删除这些位置或建筑物图像或将其显示在 https:// 而不是 http:// 后面,例如下面的案例与图像本身。
底线是...这仍然是一个问题,因为照片图像没有在 SSL 后面...
测试一下,你就会明白我在说什么。
如果有人知道解决这个问题的方法,我肯定想知道。谷歌如果您对此有解释,请告诉我们。
The bad news is if you use Google Maps - SSL API you will still sometimes get the Secure and Unsecured alert. Here is why:
Google url above displays everything under https:// to correctly display the under secured environment. However and this is a huge however issue Google now displays a picture of the building or location off to the left without https thus giving us the unsecured error we hate to get in a secured environment.
Here is a good example...take a look at the following:
https://maps-api-ssl.google.com/maps?q=1000+Ballpark+Way,+Arlington,+TX&hl=en&sll=37.0625,-95.677068&sspn=49.310476,101.425781&vpsrc=0&hnear=1000+Ballpark+Way,+Arlington,+Texas+76011&t=m&z=17
Now using Firefox or browser of your choice, right-click on the building image Info or Image Properties... and WOW! You will see that this image is causing your unsecured error when everything according to Google should be all secured behind the Google https://
The building and location images are not listed under https:// .... you will still get an error!
Check it out for yourself and you'll see what I'm seeing... so viewing Google maps behind SSL is still an issue unless someone knows of a work-a-round to get those location or building images removed or to be displayed behind https:// and not http:// such as the case below with the image itself.
Bottom line is... this is still an issue because of the photo images are not behind SSL...
Test it and you will see what I am talking about.
If anyone knows of a work-a-round for this, I'd sure like to know. Google if you have an explanation for this please let us know.
您需要使用像这样的协议相对路径:
检查这个答案:
How to Include CSS and JS files via HTTPS when need?
You need to use protocol-relative paths like this:
check this answer:
How to Include CSS and JS files via HTTPS when needed?
为此,您必须使用谷歌企业地图,但这不是免费的。
查看更多信息 - http://www.google.com/enterprise/earthmaps/maps.html
您可以尝试通过HTTPS加载Maps API v3,该API必须从主机名maps-api-ssl.google.com加载。对于静态地图 API 和 Web 服务,请使用maps.googleapis.com。
You have to use google enterprise maps for this and thats not free.
Check out more - http://www.google.com/enterprise/earthmaps/maps.html
You can try to load the Maps API v3 over HTTPS, the API must be loaded from the hostname maps-api-ssl.google.com. For the Static Maps API and Web Services, please use maps.googleapis.com.