Wednesday, December 17, 2008

IE Bug - Dynamically Created IFrames have No Name

IE has an annoying bug that when you use JavaScript to create an IFrame (or, as Jeff Norton points out in the comments, ANY element!), you can't set the name using .name or setAttribute. It just doesn't work.

I had tried to submit a form and set the target to the IFrame, and a new window popped open. WTF?

Solution is here:
http://terminalapp.net/submitting-a-form-with-target-set-to-a-script-generated-iframe-on-ie/

So instead of document.createElement("IFRAME"); do document.createElement("<iframe name="'blah'">"); and catch the exception on good browsers.

1 comment:

Anonymous said...

yeah, this is a known IE bug. You can't create ANY element and set the name attribute (kinda dumb if you ask me, but oh well)

Here's a link to the best site for IE bugs (and fixes):

http://webbugtrack.blogspot.com/2007/10/bug-235-createelement-is-broken-in-ie.html

Labels

Blog Archive

Contributors