View Full Version : How to get HTML Source in Javascript code ?
ciocan
Feb 12th 2007, 7:47 am
Hello guys,
I can't find a way to get the document source with js.
Using document.body.innerHTML , I only get html source from the body, but I need full html source of the page.
Any idea?
Thanks.
phper
Feb 12th 2007, 3:07 pm
Use XmlHttpRequest and request for the page, then getResponseText() to get the content.
nico_swd
Feb 12th 2007, 3:22 pm
Or:
document.getElementsByTagName('html')[0].innerHTML
bart.nicolotti
Nov 11th 2008, 12:11 am
Use XmlHttpRequest and request for the page, then getResponseText() to get the content.
And if I couldn't request the page again, i.e. if I've posted data that changed the status of the database and re-posting would change it again? I'm using on error to send the error happened on the browser to the server log, but as the page is dynamically generated the line is not enought, because it doesn't match the php/jsp line.
Many thanks, best regards
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.