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

如何实现KML气球内Hyperlink直接在浏览器而非Google Earth中打开?

KML气球链接直接在外部浏览器打开的实现方法

直接用JavaScript强制触发外部浏览器跳转,替代Google Earth的内部打开行为,具体操作如下:

  • 替换普通链接格式:
    原链接写法(会在Google Earth内打开):

    <a href="https://你的网址">链接文本</a>
    

    改成带JavaScript的写法(直接唤起系统默认浏览器):

    <a href="javascript:window.open('https://你的网址','_blank')">链接文本</a>
    
  • 完整KML示例片段:
    要确保气球的HTML内容放在<description>标签里,并用<![CDATA[ ]]>包裹,避免XML解析问题:

    <Placemark>
      <name>测试地标</name>
      <description>
        <![CDATA[
          <div>
            <p>点击链接直接打开浏览器:</p>
            <a href="javascript:window.open('https://example.com','_blank')">打开示例站点</a>
          </div>
        ]]>
      </description>
      <Point>
        <coordinates>116.4074,39.9042,0</coordinates>
      </Point>
    </Placemark>
    
  • 注意事项:

    • 该方法需要Google Earth支持JavaScript,桌面版和新版Web版都兼容
    • 不要省略_blank参数,它是触发外部打开的关键

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.06 19:46:01