简体   繁体   English

使用Internet Explorer打开HTML文件

[英]Opening HTML file with Internet Explorer

Good Morning Everyone, 大家,早安,

I'm trying to open an HTML file with Internet Explorer (Please, don't mind the version, I've already tried with all of them). 我正在尝试使用Internet Explorer打开HTML文件(请不要介意版本,我已经尝试了所有文件)。

That HTML file uses javascript code to create a Google Map in a div, but every time I try to open it with Internet Explorer, the browser shows the following message: 该HTML文件使用javascript代码在div中创建Google Map,但是每次我尝试使用Internet Explorer打开它时,浏览器都会显示以下消息:

"Internet Explorer has stopped this page from running scripts or ActiveX controls that could access you computer." “ Internet Explorer已阻止该页面运行可访问您计算机的脚本或ActiveX控件。”

I've already tried to change the security and privacy options but the message is still showing. 我已经尝试过更改安全性和隐私选项,但该消息仍在显示。

This is the javascript code I'm using right now: 这是我现在正在使用的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>

I will be very grateful if someone can help me or give me some advice about it. 如果有人可以帮助我或给我一些建议,我将不胜感激。

Thank you very much in advance. 提前非常感谢您。

This is normal behaviour for Internet Explorer when you open an HTML file from your computer rather than browsing to a web page. 当您从计算机打开HTML文件而不是浏览网页时,这是Internet Explorer的正常行为。

When a file is opened locally, scripts are disabled by default. 在本地打开文件时,默认情况下禁用脚本。 It may be possible to change this in the configuration, but not advisable. 可以在配置中更改此设置,但不建议这样做。 You can just click on the "allow" button and the page will run normally. 您只需单击“允许”按钮,页面即可正常运行。

Once you publish the file on a web server, IE won't disable the scripts when you browse to it. 将文件发布到Web服务器上后,IE浏览器将不会禁用脚本。

If you get tired of the button, you can add a "Mark Of the Web" to the page while you are testing, this will allow scripts to run without the warning: 如果您对按钮感到厌倦,可以在测试时在页面上添加“ Web标记”,这将允许脚本运行而不会发出警告:

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

You should naturally remove that before publishing the page to the web. 在将页面发布到网络之前,您自然应该删除该页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM