Search code examples
javascriptiframedesignmode

why window.setTimeout is required to set an iframe's designmode "on" in IE


In my experiment, I have seen that even after window.onload event, window.setTimeout is required to make an iframe editable by setting iframe's designmode "ON". And this happens in IE, while in Firefox window.setTimeout is not required. I have not tested in any other browser.

Is it necessary to use window.setTimeout to set an iframe's designmode "ON" in IE?

You can try it from here, http://www.nazmulweb.com/site5/demo/iframe/Default.aspx


Solution

  • You might be better off setting the contentEditable property of the iframe's <body> to true instead, which I think will work immediately. I've done that in WYSIWYG editors I've written, although now I can't remember why. I'm pretty sure I had decent reasons.