I know it\'s already discussed here, but there were no solution to get the whole document (including doctype).
$(document).html(); returns null
$(document).html();
null
I don't think there is a direct access to the whole document (including the doctype), but this works :
$.get(document.location, function(html) { // use html (which is the complete source code, including the doctype) });