简体   繁体   English

将Google Maps API添加到HTML

[英]adding Google Maps API to HTML

I have a very simple question. 我有一个非常简单的问题。 I need to insert Google Maps API in my HTML. 我需要在HTML中插入Google Maps API。 I am not able to do it in the Head section. 我无法在“头部”部分中执行此操作。 Is that fine if I add that code fragment in Body before it is being used or what would be better solution? 如果我在使用前在Body中添加该代码片段就可以了,还是更好的解决方案?

Thanks 谢谢

     <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false </script>

Normally the best solution is to put it to the Head, but however if you can't do it then put it just before the closing body tag. 通常,最好的解决方案是将其放置在Head上,但是,如果不能这样做,则将其放置在关闭body标签之前。

Just one more thing, you have to close your script tag '>' and end the string, like here: 只是一件事,您必须关闭脚本标签'>'并结束字符串,如下所示:

 <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM