function getAllHtml() {
    var node = document.doctype;
    if (node) {
        var docType = "<!DOCTYPE "
         + node.name
         + (node.publicId ? ' PUBLIC "' + node.publicId + '"' : '')
         + (!node.publicId && node.systemId ? ' SYSTEM' : '')
         + (node.systemId ? ' "' + node.systemId + '"' : '')
         + '>';
        //
        return docType + "\n" + document.documentElement.outerHTML;
    } else {
        return document.documentElement.outerHTML;
    }
}
getAllHtml();