Is there a way in JS to get the entire HTML within the html tags, as a string?
MS added the
innerHTML properties some time ago.
According to MDN,
outerHTML is supported in Firefox 11, Chrome 0.2, Internet Explorer 4.0, Opera 7, Safari 1.3, Android, Firefox Mobile 11, IE Mobile, Opera Mobile, and Safari Mobile.
outerHTML is in the DOM Parsing and Serialization specification.
See quirksmode for browser compatibility for what will work for you. All support
var markup = document.documentElement.innerHTML; alert(markup);