Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE10 XML does not get formatted inside iframe

I am writing a simple HTML file. I would like to embed an XML in it. I do this using iFrames. In IE9 the XML is formatted (though it shows activeX warnings). If I run the same code in IE10 I do NOT see the formatting at all. I see only the XML content. However if I open the XML separately I am able to see the formatting.

How do I get the formatting in IE10 inside iframe? Thanks in advance.

Here is my HTML code

<html>
  <head>
    <title>Test Code</title>
  </head>
  <body>
    <iframe src="sample.xml"></iframe>
  </body>
</html>

And my sample.xml is

<?xml version="1.0" encoding="utf-8" ?>
<test>asd</test>

-- Update: Switching the browser to IE8 Standards mode works.

<meta http-equiv="X-UA-Compatible" content="IE=8" />

Is this the only solution or is there an IE10 based better solution for this?

like image 598
Sornakumar Avatar asked Mar 23 '12 07:03

Sornakumar


1 Answers

We just had this problem, and found a bunch of questions like this with no answers! Finally we found the answer from Microsoft here: System working as designed :-(

From our friends at Microsoft:

As of IE9, IE has had native support for rendering XML content including XHTML and SVG. To avoid conflicts with this native support, the auto-generated tree view for XML was scoped to only apply to top-level documents. Thus, when XML content is hosted inside an IFRAME, a tree view will not automatically be generated by default. However, when the browser is running in Compatibility View, IE tries to more closely emulate the behavior of previous releases, which is why the tree view is still displayed under these circumstances.

like image 71
spozun Avatar answered Oct 13 '22 19:10

spozun