"对象不支持属性或方法“querySelector'"显示了机器名在IE11访问网站的时候 [英] "Object doesn't support property or method 'querySelector'" shows when accessing site by machine name in IE11

查看:5156
本文介绍了"对象不支持属性或方法“querySelector'"显示了机器名在IE11访问网站的时候的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经部署到IIS我的防火墙内部的Windows Server 2012中R2主机上的angularjs网站。当我RDP到服务器,并从那里,导航到

I have an angularjs site deployed to IIS on a Windows Server 2012 R2 host inside my firewall. When I RDP into the server and, from there, navigate to

http://localhost/Foo 

在IE11,一切都表现为人们所期望的。我的页面提供给浏览器

in IE11, everything behaves as one would expect;my page is served to the browser.

但是,当我试图浏览

http://servername/Foo

在IE11,我从angular.js的1016线引发的错误

in IE11, I get an error thrown from line 1016 of angular.js

对象不支持属性或方法querySelector'。

"Object doesn't support property or method 'querySelector'"

这仅发生在Internet Explorer。结果
一切都测试了罚款在Chrome以及Firefox浏览器。

This only occurs in Internet Explorer.
Everything tested out fine in Chrome as well as Firefox.

有没有人有一个线索,为什么发生这种情况和我可以做什么来解决它?

Does anyone have a clue as to why this is happening and what I can do to fix it?

推荐答案

解决这个问题是要添加

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

标签的作为第一个项目的在

的meta标签必须处于头部的第一个标记为IE拿起边沿模式;否则,忽略了应该指示IE不要陷入怪癖模式的DOCTYPE。

The meta tag has to be the first tag in the head for IE to pick up edge mode; otherwise, it ignores the DOCTYPE that is supposed to instruct IE not to fall into quirks mode.

我已经包含meta标签作为一种事后当我部署,并在头底部已键入它

I had included the meta tag as an afterthought when I was deploying and had typed it in at the bottom of the head.

MSDN |指定旧文档模式

的X-UA-Compatible标头不区分大小写;但是,它必须除了标题元素和其他meta元素的所有其他元素之前出现在网页(HEAD部分)的头。

The X-UA-Compatible header isn't case sensitive; however, it must appear in the header of the webpage (the HEAD section) before all other elements except for the title element and other meta elements.

显然设置

<!DOCTYPE html>

里面的网页不够安抚IE浏览器。通过引用的http我的网站时,浏览器仍然拿起IE7作为其默认文档模式://机:80

这是由于默认的兼容性设置在Internet Explorer中用于查看导致IE的静静地表现不同的内部网站的会比外部网站。

This was due to the default Compatibility Settings in Internet Explorer for viewing internal sites that cause IE to silently behave differently than it would for external sites.

设置在X-UA兼容meta标签明确声明,内部的浏览器应接收EDGE模式的网站,而以管理兼容性设置的要求,但必须以有这种效果被指定为头的第一个标签

Setting the X-UA-Compatible meta tag explicitly declares that internal browsers should be receiving the site in Edge mode without the requirement to administrate Compatibility Settings, but must be specified as the first tag in the head in order to have this effect.

这篇关于&QUOT;对象不支持属性或方法“querySelector'&QUOT;显示了机器名在IE11访问网站的时候的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆