问题
I am working on a site that does not render in IE 11, but works fine in every other browsers.
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.
However, when I add the site under Compatibility View settings
the page renders correctly, but then causes other problems.
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.
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.
回答1:
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.
Tracking down the cause of this problem lead me to the culprit: mobile.browser file in App_Browsers
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.
回答2:
I have the same problem in IE 11.0.9600. And figured it out if the webpage is loaded in the compatibility view, the data is not complete. However, if it is NOT in compatibility view (Settings/Compatibility View Settings, remove the domain), problem solved, and all my $().find() works okay.
来源:https://stackoverflow.com/questions/21191420/incomplete-html-in-ie-11