Well, document.body.innerHTML works only when the page has <body>...</body>
tag in the page. But if the page loading is interrupted due to 开发者_如何学编程any reason, the page will have <body>
tag but no </body>
tag. So, document.body.innerHTML will not work. How to get the HTML code of the page??
Each document has a root element, even if there is no body. So document.documentElement.innerHTML
should always work.
精彩评论