You can set document. designMode of iframe to On to make it editable. It is generally used in Rich Text Editor components. Here, only the differences between different browsers are shown as follows:
The Code is as follows:
After the document. designMode of iframe is set, only the body. innerHTML of Firefox is br.
Script
Var ifr = document. getElementsByTagName ('iframe') [0];
Var doc = ifr.content##doc ument;
Function prif (){
Lele.log(ifr.content+doc ument. body. innerHTML );
}
Function changeDesignMode (){
Ifr.content+doc ument. designMode = 'on ';
}
Prif ();
Script
The above Code does not contain any html tag in the body of iframe. In normal conditions, ifr.content20.doc ument. body. innerHTML should be a null string. But Firefox is a bit special.
Follow these steps.
Open the html in Firefox and an empty string is output by default.
In the console, run the changeDesignMode method and then the prif method. The output innerHTML is
", As shown below
Chrome/Safari/Opera still outputs a null string.