Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
361 views
in Technique[技术] by (71.8m points)

javascript - iframe not rendering in ie9 mode when containing page is in quirks mode

I have an iframe in a page that runs in quirks mode (I don't have control over the containing page), and I need my page to render in a mode that is compatible with modern browser features.

The contained page makes heavy use of newer JavaScript features (especially the nice array functions), and SVG rendering. While I can shim the array functions easily enough, I can't force the svg to render.

To be clear, the inner page is NOT running in quirks mode - I have specified a doctype and the ie=edge < meta > tag. It looks like it's using the ie8 rendering mode (hard to be certain)

A sample of the issue is here: http://stevesspace.com/quirks/quirks.html - load it up in chrome to see the expected output, and check it in IE9 or 10 for the actual output.

EDIT: I've added the document mode and compatibility mode to the sample, I can confirm it's using IE8 doc mode.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I ended up using an object tag instead of an iframe, it seems to work ok across modern browsers.

<object type="text/html" data="http://example.com"></object>

It turns out you can't modify the URL using javascript in IE9, but that's not a big deal - removing/adding a new object element works just as well for this.

Update: This tag can also be in an intermediate page that the iframe points to and it all works fine Update 2: This solution does not work in IE10


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...