【问题标题】:How to avoid CSS scrubbing in Google Earth balloons如何避免在 Google 地球气球中清除 CSS
【发布时间】:2012-01-12 22:59:38
【问题描述】:

我一直在研究这个问题。我有一个我正在处理的项目,它基本上代表了不同位置的游览,每个位置都是在 Google 地球网络播放器中动态生成的。问题是客户要求代表位置的每个地标的内容更时尚。当然,我很快发现 Google 地球会恶意清除您放入 KMZ 文件中的所有 CSS,这非常烦人。许多在线讨论都谈到了将 !important 关键字放在 CSS 声明中或以一些​​有趣的方式使用气球样式来防止这种情况。到目前为止,我还没有找到具体的解决方案。

我只是想知道 Google 地球是否有破解或方法可以不简单地删除您的所有 CSS。这可以包括在页面加载后从外部源导入或插入 CSS 和/或在必要时放入一个小 jQuery。我将提供一个典型气球应该是什么样子的代码模板。请注意,这实际上可以在 Google 地球程序中使用,但不能在线使用。

</Placemark>
<Placemark id="placemark1">
  <name>City</name>
  <description>
  <![CDATA[<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
          <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
          <title>Untitled Document</title>
    </head>
    <body>
    <link href="http://localhost/Kmz_Files/player.css>
    <div class="container" >
            <span class = "title">My location</span>
            <hr>
            <div>

    <a href="http://www.google.com" target="_blank">
    <img src="http://www.google.ca/images/srpr/logo3w.png" width="250" /> 
    </a>
            </div>
            <hr>
            <p> My description</p>
    </div>
    </body>
    </html>]]>
    </description>
  <Point>
    <coordinates>-45, 45</coordinates>
  </Point>
</Placemark>

【问题讨论】:

    标签: css kml google-earth google-earth-plugin kmz


    【解决方案1】:

    您说的好像是 Google 地球插件,而不是 Google 地球桌面应用程序,它不会清除 JavaScript 或 CSS。

    看起来你想使用getBalloonHtmlUnsafe()。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多