Viewing dynamic HTML in a .chm topic
March 2nd, 2004
Here's a useful tip if you use a JavaScript file to dynamically rewrite the HTML of your topics. For example, I use a .js file that adds HTML content to every topic at runtime. This keeps the topic files nice and small, reduces the size of the .chm file and makes the HTML of the topics tidier and easier to edit.
But sometimes you want to see the resulting HTML, after the .js file has done its work. You can't use View Source because all you get is the static HTML. One way to display the dynamic HTML is to:
1. Open the .chm file and display the page you're interested in.
2. Right click a topic in the Contents pane.
3. Choose Jump to URL.
4. In the Jump to this URL field, paste this:
javascript:void(window.open("javascript:document.open('text/plain');document.write(opener.document.body.parentNode.outerHTML)"))
When you press OK, the HTML is displayed in a new IE window. The HTML that is displayed is the HTML that the browser window in the Help Viewer uses when displaying the topic.
UPDATE - Jan 2009
The above doesn't work in Internet Explorer 7. However, this does work:
javascript:window.open("").document.open("text/plain", "").write(document.documentElement.outerHTML);
As above, paste this into the Jump to URL dialog box.
Potentially similar posts
- Archived post summaries – June 2011
- How to: Get a white screen – June 2011
- Viewing dynamically generated HTML in the HTML Help viewer – November 2010
- Fix “No topics found” issue in CHM output – November 2010
- Problems with Flare 2.0 – January 2007