Theocacao
Leopard
Design Element
Comment on "ContentEditable / DesignMode in FireFox"
by Rob Reid — Feb 14
I have done the same thing as in create the iframe on the fly and then set the properties for it. I have found that you cannot set designmode on for Moz browsers straight away so use a try catch and a set timeout.

Also I have a problem that the caret/cursor keeps disapearing in the iframe and I cannot seem to find any code to force it to appear and move it to the end of the content especially when I have to reload the iframe through code (e.g to get round IEs non relative URI issue) does anyone have a solution for this?

function MakeEditable()
{
var theIframe = document.getElementById("myeditor")

theIframe.contentWindow.document.body.contentEditable = true;

//in moz you cannot change desgin mode straight away so try and then retry
try{
theIframe.contentWindow.document.designMode = "on";

}catch(e){
setTimeout(MakeEditable,250);
return false;
}


return true;
}
Back to "ContentEditable / DesignMode in FireFox"
Design Element

Copyright © Scott Stevenson 2004-2015