Viewing dynamically generated HTML in a help topic
January 2nd, 2009
This is an old tip (see Viewing dynamic HTML in a .chm topic from March 2004) but worth knowing.
Suppose you have some JavaScript in a help topic that alters the HTML of the page - for example, it might do some transformations onLoad, or it might be doing AJAX-type stuff in response to input from the user). To debug the JavaScript you need to be able to check the HTML to make sure the transformations are occurring as designed. Right-clicking and choosing View Source is no good because you only see the original HTML saved in the file, before any transformations happened.
To see the dynamically generated HTML as it is right now:
- Copy the following:
javascript:window.open("").document.open("text/plain", "").write(document.documentElement.outerHTML); - Right-click the title bar of the HTML Help Viewer.
- Choose Jump to URL.
- In the Jump to URL dialog box, paste the text you copied in step 1.
The HTML is displayed in a new Internet Explorer window.
Potentially similar posts
- Archived post summaries – June 2011
- How to: Get a white screen – June 2011
- Adding your choice of text editor to Flare’s Open With menu – December 2010
- Viewing dynamically generated HTML in the HTML Help viewer – November 2010
- Use the existence of a file on the server to determine Javascript behaviour in the browser – November 2010