Home > Web Front-end > JS Tutorial > After setting the document.designMode of the iframe, only its body.innerHTML is br_javascript in Firefox

After setting the document.designMode of the iframe, only its body.innerHTML is br_javascript in Firefox

WBOY
Release: 2016-05-16 17:55:51
Original
1644 people have browsed it

Reproduce as follows:

Copy code The code is as follows:




After setting the document.designMode of the iframe, only its body.innerHTML in Firefox is br




< script>
var ifr = document.getElementsByTagName('iframe')[0];
var doc = ifr.contentWindow.document;
function prif() {
console.log(ifr.contentWindow .document.body.innerHTML);
}
function changeDesignMode() {
ifr.contentWindow.document.designMode = 'On';
}
prif();
< ;/script>



No html tags are written in the body of the iframe in the above code. Under normal circumstances, the output ifr.contentWindow.document.body.innerHTML should be an empty string. But Firefox is a bit special.
Please follow the steps below.
When opening this html in Firefox, an empty string is output by default
After setting the document.designMode of the iframe, only its body.innerHTML is br_javascript in Firefox
Execute the changeDesignMode method in the console, and then execute the prif method. At this time, the output innerHTML is "
", as follows
After setting the document.designMode of the iframe, only its body.innerHTML is br_javascript in Firefox
Chrome/Safari/Opera still outputs an empty string.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template