I am wondering if it is possible to use jQuery to switch out all <object>
tags on a site for <iframe>
tags when loading on IE 8 and below. In essence, this would allow the page to be XHTML 1.1
valid and not have to be double-coded all the time, eliminating the need to spend so much time focusing on non-standard browsers.
The data=
attribute would need to be changed to src=
, I'd like to insert frameborder="0"
, and all of the style
values for the <object>
tag would also need to be set for the <iframe>
tag.
My goal here is not to create a debate on <iframe>
s vs <object>
s, I just think that this would be a huge tmie saver, and encourage proper, strict xhtml
coding practices.
Thanks for any input!
For a basic rundown on how to change an element's type see jQuery convert DOM element to different type (no idea whether it'll work properly in XHTML, but it well might), but I don't think this is a good idea at all. I can see it cause delays on older machines (on which IE6 runs), and obviously, it won't work when JavaScript is disabled. All that to achieve valid code? Not a good idea IMO.
Before doing that, if the code has to be valid under any circumstances, I'd consider serving different code to IE6 on server side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With