2014-10-02 200 views
0

早上好大家,用Internet Explorer打開HTML文件

我想用IE瀏覽器打開一個HTML文件(請不要介意這個版本,我已經試過了所有這些文件)。

這HTML文件使用JavaScript代碼在一個div創建一個谷歌地圖,但每次我嘗試使用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> 

我會很感激,如果有人能幫助我或者給我一些關於它的意見。

非常感謝您提前。

+0

您是否嘗試過禁用XSS過濾器?一個。打開Internet Explorer。 b。點擊工具,然後點擊Internet選項。 c。切換到安全選項卡。 d。選擇Internet區域。 e。點擊自定義級別。 f。在腳本下,選擇Enable XSS filter下的單選按鈕「Disable」。 g。單擊確定保存更改。 – nwaltham 2014-10-02 10:55:37

回答

0

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

當本地打開文件時,默認情況下禁用腳本。有可能在配置中改變這一點,但不可取。您只需點擊「允許」按鈕,頁面將正常運行。

一旦您在Web服務器上發佈文件,當您瀏覽到它時,IE將不會禁用腳本。

如果你厭倦了按鈕,你可以添加到頁面,而你正在測試,這將允許腳本沒有警告的情況下「在Web標記」:

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

你自然應該在將網頁發佈到網絡之前刪除它。

+0

我永遠不會有足夠的時間感謝你的迴應。 IE不再顯示該消息。謝謝,古法。 – Javier 2014-10-02 15:24:15

相關問題