簡體   English   中英

使用Internet Explorer打開HTML文件

[英]Opening HTML file with Internet Explorer

大家,早安,

我正在嘗試使用Internet Explorer打開HTML文件(請不要介意版本,我已經嘗試了所有文件)。

該HTML文件使用javascript代碼在div中創建Google Map,但是每次我嘗試使用Internet Explorer打開它時,瀏覽器都會顯示以下消息:

“ Internet Explorer已阻止該頁面運行可訪問您計算機的腳本或ActiveX控件。”

我已經嘗試過更改安全性和隱私選項,但該消息仍在顯示。

這是我現在正在使用的javascript代碼:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
    var directionsDisplay;
    var directionsService = new google.maps.DirectionsService();

    function initialize() {
      directionsDisplay = new google.maps.DirectionsRenderer();
      var mapOptions = {
        zoom: 12,
        center: new google.maps.LatLng(40.4889323, -3.6927295),
        mapTypeId: google.maps.MapTypeId.ROADMAP
      };
      var map = new google.maps.Map(document.getElementById('map-canvas'),
          mapOptions);
      directionsDisplay.setMap(map);
      calcRoute();

    }

    function calcRoute() {
      var start = new google.maps.LatLng(40.4889323, -3.6927295);
      var end = new google.maps.LatLng(40.5485301,-3.648655);
      var request = {
        origin: start,
        destination: end,
        waypoints: [
                    {
                        location: new google.maps.LatLng(40.662707,-3.771187),
                        stopover: true
                    }
                    ],
        travelMode: google.maps.TravelMode.DRIVING
      };
      directionsService.route(request, function(response, status) {
        if (status == google.maps.DirectionsStatus.OK) {
          directionsDisplay.setDirections(response);
        }
      });
    }

    google.maps.event.addDomListener(window, 'load', initialize);

</script>

如果有人可以幫助我或給我一些建議,我將不勝感激。

提前非常感謝您。

當您從計算機打開HTML文件而不是瀏覽網頁時,這是Internet Explorer的正常行為。

在本地打開文件時,默認情況下禁用腳本。 可以在配置中更改此設置,但不建議這樣做。 您只需單擊“允許”按鈕,頁面即可正常運行。

將文件發布到Web服務器上后,IE瀏覽器將不會禁用腳本。

如果您對按鈕感到厭倦,可以在測試時在頁面上添加“ Web標記”,這將允許腳本運行而不會發出警告:

<!-- saved from url=(0021)http://www.google.com -->

在將頁面發布到網絡之前,您自然應該刪除該頁面。

暫無
暫無

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

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