Return Home

View HTML Source Generated by AJAX

posted by Eric Appel      5 Comments

One of the challenging things about debugging an AJAX application is that it isn't obvious how to view the html source that is being rendered by the browser after you have made modifications to it via an AJAX callback.  If you use the browser's built-in View Source command then it will show you the source that was used to render the original page, but it will not include any modifications made via javascript/AJAX calls.

To figure out how to view the generated source I turned to Google and found Rumen Stankov's post on telerik blogs. 

If you are trying to view the generated source in Firefox, the simplest way is to first download and install the Web Developer extension.  Then go to the View Source menu item and select "View Generated Source".

To view the generated source in IE you can type the following in the address bar

javascript:'<xmp>' + window.document.body.outerHTML+ '</xmp>'

Or you can use this bookmarklet (Drag to links bar or add to Favorites): View Generated Source

Thursday, April 19, 2007 4:39:15 AM (Pacific Daylight Time, UTC-07:00)
That's excellent, thanks! Did you know you can also use the DOM Explorer that is built into IE's <a href="http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en">Developer Toolbar</a>?

Mike
Mike
Saturday, August 25, 2007 3:41:00 PM (Pacific Daylight Time, UTC-07:00)
Any idea of how you can achieve this programatically (in vb.net for example)? I need to interact with a 3rd party ajax based web app using the webbrowser control or similar.
John
Monday, October 29, 2007 7:27:14 AM (Pacific Daylight Time, UTC-07:00)
I doubt you can access those controls from code behind..
anjum
Monday, November 10, 2008 2:18:26 PM (Pacific Standard Time, UTC-08:00)
Hi, did anyone achieve to get <b>updated</b> source code from vb.net webbrowser?
Tuesday, May 12, 2009 1:16:28 PM (Pacific Daylight Time, UTC-07:00)
I am writing a program that generates an xml file. I want to see the generated source file in the browser. But of course, when I output my xml text lines to the browser, it does not display as text, but as the xml.
Any ideas on how I can view a text file that begins <?xml version="1.0" encoding="ISO-8859-1" ?> as text without closing down my app?
jim
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview