簡體   English   中英

嵌入Google Maps導致IE9崩潰

[英]IE9 crashes with Google Maps embed

我需要這方面的幫助。 我將Google地圖嵌入在寬度=“ 100%”和高度=“ 100%”的頁面中。 一切正常,除非使用IE9,否則它會崩潰。 有什么辦法嗎?

我感謝您的幫助。

這是來自Google的示例地圖 ,它創建了可以在IE9中正常工作的完整頁面地圖:

<!DOCTYPE html>
<html>
  <head>
    <title>Google Maps JavaScript API v3 Example: Map Simple</title>
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta charset="UTF-8">
    <style type="text/css">
      html, body, #map_canvas {
        margin: 0;
        padding: 0;
        height: 100%;
      }
    </style>
    <script type="text/javascript"
        src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
      var map;
      function initialize() {
        var myOptions = {
          zoom: 8,
          center: new google.maps.LatLng(-34.397, 150.644),
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById('map_canvas'),
            myOptions);
      }

      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  </head>
  <body>
    <div id="map_canvas"></div>
  </body>
</html>

嘗試使用view port meta標簽設置寬度,並確保將html正文和map div都設置為100%高度,並將margin / padding設置為0。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM