【问题标题】:Opening HTML file with Internet Explorer使用 Internet Explorer 打开 HTML 文件
【发布时间】:2014-11-27 08:26:01
【问题描述】:

大家早上好,

我正在尝试使用 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>

如果有人可以帮助我或给我一些建议,我将非常感激。

非常感谢您。

【问题讨论】:

  • 您是否尝试过禁用 XSS 过滤器?一种。打开 Internet Explorer。湾。单击工具,然后单击 Internet 选项。 C。切换到安全选项卡。 d。选择互联网区域。 e.单击自定义级别。 F。在脚本下,选择启用 XSS 过滤器下的单选按钮“禁用”。 G。单击“确定”保存更改。

标签: javascript html google-maps internet-explorer


【解决方案1】:

当您从计算机打开 HTML 文件而不是浏览网页时,这是 Internet Explorer 的正常行为。

在本地打开文件时,默认情况下禁用脚本。可以在配置中更改此设置,但不建议这样做。您只需点击“允许”按钮,页面就会正常运行。

在网络服务器上发布文件后,IE 不会在您浏览到它时禁用脚本。

如果您厌倦了这个按钮,您可以在测试时在页面上添加一个“Web 标记”,这将允许脚本在没有警告的情况下运行:

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

在将页面发布到网络之前,您应该自然地删除它。

【讨论】:

  • 我永远没有足够的时间感谢您的回复。 IE 不再显示该消息。谢谢你,古法。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-21
相关资源
最近更新 更多