Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript Error in IE9 "SCRIPT5022: DOM Exception: INVALID_CHARACTER_ERR (5)"

Tags:

javascript

When I debug in IE9, It breaks on the following line

{var c=document.createElement('<iframe id="'+a+'" name="'+a+'" />')

with the following error:

SCRIPT5022: DOM Exception: INVALID_CHARACTER_ERR (5) 
wmd.js, line 1 character 97

I am using OSQA software, and the bug may be reproduced with the latest version of IE9 (possibly with web developer toolbar installed)

http://meta.osqa.net/questions/ask/ (bug may be reproduced as of 1/3/12)

If you visit that page, open up the javascript console, and attempt to upload any image using the image uploader, the error occurs.

This only breaks on IE9 for some reason

Update

I'm a bit new to this javascript debugging business, but I opened up the watch menu and the value of "a" is: jUploadFrame1325624808664

like image 482
Brian Webster Avatar asked Aug 02 '26 15:08

Brian Webster


1 Answers

The createElement method expects only the name of the element to create. Like this:

var c = document.createElement("iframe")

Properties can be added to the new element later:

c.id = c.name = a;

Previous versions of IE allowed you to provide this function with arbitrary HTML, but that was never part of the spec and is no longer supported in IE9.

like image 128
Wayne Avatar answered Aug 07 '26 04:08

Wayne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!