IE 11中的HTML不完整 [英] Incomplete HTML in IE 11

查看:135
本文介绍了IE 11中的HTML不完整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个无法在IE 11中呈现但在其他所有浏览器上都能正常工作的网站上.

I am working on a site that does not render in IE 11, but works fine in every other browsers.

当我使用F12开发人员工具调试它时,DOM基本上是空的,除了标头部分除外.当我查看源代码时,它仅返回标题部分和导航的一部分.

When I debug it using F12 Developer Tools, the DOM is essentially empty except from the header section. When I view the source code, it only returns the header section and part of the navigation.

但是,当我在Compatibility View settings下添加网站时,页面可以正确显示,但随后会引起其他问题.

However, when I add the site under Compatibility View settings the page renders correctly, but then causes other problems.

我想解决根本问题,而不是要求用户添加到兼容模式"或必须设置与x-ua兼容的标头标记.

I would like to fix the underlying issue rather than require users to add to Compatibility Mode or have to set the x-ua-compatible header tag.

我不认为是什么原因会导致它仅具有从服务器发送的HTML的一部分.当我查看源代码"时,它并不是在解析HTML以创建DOM或运行任何JavaScript.只是假设要显示服务器向下发送的HTML.

I cannot think what would cause it to only have a portion of the HTML sent from the server. When I "View Source", it's not like it is parsing the HTML to create the DOM or running any JavaScript. It is simply suppose to show the HTML that the server sent down.

推荐答案

经过进一步调试,我能够确定在IE 11上发出的请求返回的内容类型设置为

After further debugging, I was able to determine that requests made on IE 11 were returning with a content-type set to application/xhtml+xml instead of text/html.

跟踪此问题的原因将我带到罪魁祸首:App_Browsers中的mobile.browser文件

Tracking down the cause of this problem lead me to the culprit: mobile.browser file in App_Browsers

删除此文件后,现在将以正确的content-type返回我的请求,并且IE 11可以毫无问题地呈现页面.

Once this file was deleted, my requests were now returned with the correct content-type and IE 11 was able to render the page without a problem.

希望这对其他人有帮助.

Hope this helps others.

这篇关于IE 11中的HTML不完整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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