从共享网址嵌入Google地图

时间:2018-12-20 06:35:52

标签: google-maps

如果我有一个字符串网址,例如.gitattributes

如何使用 javascript

获取网址HEAD

1 个答案:

答案 0 :(得分:0)

  1. 单击链接:https://goo.gl/maps/h3maMVM6JHJ2

解析为:

https://www.google.com/maps/place/Wal+Mart/@1.0124826,102.7074445,17z/data=!3m1!4b1!4m5!3m4!1s0x31d6da283960bf79:0xff2a6dc939314ae0!8m2!3d1.0124826!4d102.7096332
  1. 单击共享图标:

share icon

  1. 点击“嵌入地图”:

embed map

  1. 点击“复制HTML”

copy HTML

您将获得一个具有<iframe>属性的src=

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3989.1953868324035!2d102.70744451475375!3d1.0124825992614412!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x31d6da283960bf79%3A0xff2a6dc939314ae0!2sWal+Mart!5e0!3m2!1sen!2sus!4v1545288648700" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3989.1953868324035!2d102.70744451475375!3d1.0124825992614412!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x31d6da283960bf79%3A0xff2a6dc939314ae0!2sWal+Mart!5e0!3m2!1sen!2sus!4v1545288648700" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>