Embedding text / html in an object (instead of an iframe)

<iframe data="/localfile.html" type="text/html" width="200" height="200"></iframe> <iframe data="http://example.com/remotefile.html" type="text/html" width="200" height="200"></iframe> <object data="/localfile.html" type="text/html" width="200" height="200"></object> <object data="http://example.com/remotefile.html" type="text/html" width="200" height="200"></object> 

In every browser except IE, all 4 of these tests work. In IE 6 and 7, the latter crashes and shows an empty frame. Is there a workaround that allows IE to load external html into an object?

+7
html cross-browser internet-explorer cross-domain iframe
source share
1 answer

Review the following information on how to use Object with IE: http://aplus.rs/web-dev/insert-html-page-into-another-html-page/

It comes down to the difference in what IE expects from other browsers. For IE, you should use the classid attribute instead of the type attribute. For example (from the site mentioned above):

 <!--[if IE]> <object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" data="some.html"> <p>backup content</p> </object> <![endif]--> <!--[if !IE]> <--> <object type="text/html" data="some.html"> <p>backup content</p> </object> <!--> <![endif]--> 

Note that classid is specific to the type of content that you are trying to execute on the server.

+6
source share

All Articles