IE10 XML is not formatted inside iframe

I am writing a simple HTML file. I would like to embed XML in it. I do this using iFrames. In IE9, XML is formatted (although it does display ActiveX warnings). If I run the same code in IE10, I DO NOT see formatting at all. I only see XML content. However, if I open the XML separately, I can see the formatting.

How to get 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

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

- Update. The mode of switching the browser to IE8 mode works.

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

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

+6
source share
2 answers

We only had this problem, and we found a bunch of questions like this without answers! Finally, we found the answer from Microsoft here : A working system like: - (

From our friends at Microsoft:

Like IE9, IE has built-in support for rendering XML content including XHTML and SVG. To avoid conflicts with this support, the auto-generated tree view for XML was only covered for top-level documents. Thus, when XML content is placed inside an IFRAME, the tree view will not automatically be generated by default. However, when the browser is in compatibility mode, IE tries to more accurately mimic the behavior of previous releases, which is why a tree display is shown in these circumstances.

+1
source

The php file can read the xml file and then compile the xml coloring and output html code, possibly.

0
source

Source: https://habr.com/ru/post/911476/


All Articles