I’m trying to get page source together with doctype, head and body.
window.content.document is document but I can’t collect anything except innerHTML which does not include doctype.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
DOCTYPE isn’t included because it isn’t a child of the document element, it’s rather a direct child of the document itself. You can serialize the entire document using XML serializer however:
This will do an XML serialization – not quite the same thing as HTML. If that’s a problem you can go through the
window.content.document.childNodescollection and getnode.innerHTMLfor the element nodes (node.nodeType == 1), only useXMLSerializeron the rest of them. See https://developer.mozilla.org/en/XMLSerializer for more info.