You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用Iframe在网站中嵌入Google地图

在自有网站嵌入Google地图的解决方案

直接用src="https://www.google.com/search?igu=1"这类普通搜索链接嵌入Google地图,会因为跨域限制、Google访问机制限制导致无法正常显示,推荐使用官方支持的两种嵌入方式:

  • 方法一:使用Google地图嵌入API(稳定且功能灵活)

    1. 前往Google Cloud平台创建项目,启用「Maps Embed API」并获取专属API密钥;
    2. 使用以下格式的iframe代码嵌入,替换对应参数即可:
      <iframe
        width="600"
        height="450"
        style="border:0"
        loading="lazy"
        allowfullscreen
        src="https://www.google.com/maps/embed/v1/place?key=你的API密钥
          &q=目标地点地址/坐标/关键词">
      </iframe>
      
  • 方法二:直接生成嵌入代码(无需API密钥,快速实现)
    打开Google地图网页,定位到需要嵌入的地点,点击左下角「分享」按钮,选择「嵌入地图」标签,复制生成的iframe代码,直接粘贴到你的网站页面代码中即可。

嵌入失败的Google地图

内容的提问来源于stack exchange,提问作者Ayezan riaz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 23:24:54