I need to get whole content of iframe from the same domain. Whole content means that I want everything starting from <html>
(including), not only <body>
content.
Content is modified after load, so I can't get it once again from server.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to fix IE ClearType + jQuery opacity problem i
- void before promise syntax
- jQuery add and remove delay
If it is on the same domain, you can just use
to get the content of the iframe, except for the
<html>
and</html>
tag, whereI belive I've found the best solution:
In
content
we have full iframe content, includingDOCTYPE
element, which was missing in previous solutions. And in addition this code is very short and clean.You can get the literal source of any file on the same domain with Ajax, which does not render the html first-
//
fetchSource(location.href, printSourceCode);