Initially you need to get html through AJAX request after use DOMParser.
var parser = new DOMParser();
var doc = parser.parseFromString("<html_string>", "text/html");
OR
var doctype = document.implementation.createDocumentType(
'html',
'-//W3C//DTD XHTML 1.0 Strict//EN',
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
);
var dom = document.implementation.createDocument(
'http://www.w3.org/1999/xhtml',
'html',
doctype
);
// assign the body of your page, after you can use dom variable.
dom.documentElement.innerHTML = '<head></head><body></body>';