Javascript 使用Internet Explorer打开HTML文件

Javascript 使用Internet Explorer打开HTML文件,javascript,html,google-maps,internet-explorer,Javascript,Html,Google Maps,Internet Explorer,各位早上好, 我正在尝试用Internet Explorer打开一个HTML文件,请不要介意版本,我已经试过了 该HTML文件使用javascript代码在div中创建Google地图,但每次我尝试使用Internet Explorer打开它时,浏览器都会显示以下消息: Internet Explorer已停止此页运行可访问您的计算机的脚本或ActiveX控件 我已经尝试更改安全和隐私选项,但消息仍在显示 这是我现在正在使用的javascript代码: <script type="text

各位早上好,

我正在尝试用Internet Explorer打开一个HTML文件,请不要介意版本,我已经试过了

该HTML文件使用javascript代码在div中创建Google地图,但每次我尝试使用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 -->

在将页面发布到web之前,您应该先将其删除。

您是否尝试过禁用XSS筛选器?A.打开Internet Explorer。B单击工具,然后单击Internet选项。C切换到安全选项卡。D选择Internet区域。E单击自定义级别。F在脚本下,选择启用XSS筛选器下的单选按钮“禁用”。G单击“确定”保存更改。我将永远没有足够的时间感谢您的回复。IE不再显示该消息。谢谢你,古芙。