Is it possible to get the source of the current HTML document, exactly as it was loaded, in text form? (i.e. not the “Generated source” after parsing and DOM manipulation.)
Note: Issuing an extra AJAX request to retrieve the HTML page again is not an option in this case: The document could have changed.
Most browsers have a “view source” functionality, which would provide exactly what I want – so browsers keep the original HTML content anyway. Would be nice, if I could access that…
You can’t do this with JavaScript, the browser has no responsibility to keep the original document really. Is making an AJAX request with a timestamp an option? You could store the loaded date of the page with
new Date()and pass this timestamp to the server when asking for the document again, if a history was available.Other than that…I’m not sure how you’d do this with JavaScript/HTML. What is your actual end-game goal here though? Are you seeing if a
<form>and it’s inputs changed, or something else?