How do I obtain the current page's source using JavaScript and DOM?
Would I have to use AJAX?
The current page's source:
document.documentElement.outerHTML
Obviously, that is what the page looks like right now. In case of DHTML, if you want to get the unmodified source as it was served from the server, you will need to make an AJAX call to receive it again, and capture it there.
EDIT: was incorrectly innerHTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With