Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / HTML

View Source of ShowModalDialog

3.31/5 (19 votes)
12 Sep 2005 1  
How to View Source of a window opened using ShowModalDialog

Introduction

Simple problem ... During web development, how do you View Source of a window spawned using ShowModalDialog?

In the webpage <HEAD> section add this javascript:

<script language="javascript"><BR>   function viewSource()<BR>   {<BR>      d=window.open();<BR>      d.document.open('text/plain').write(document.documentElement.outerHTML);<BR>   }<BR></script><BR><BR>
Then, anyplace in your <BODY> add the following HTML

<input type=button value="View Source" onclick="viewSource()">


Yeah, I know. Really Simple. But took me almost an hour of searching to figure it out.


Enjoy

=============== Editor: Please trash below ==================

The CodeProject wizard wants more words. Apparently, a code article must have at least 100 words or the wizard doesn't think it contains enough important information. But unfortunately, this sample is very quick and easy to understand so no more words are necessary. Meaning I gotta fill up the 100 word limit with this trash (smile) maybe the editors will remove this trash before the article get's published

=============== Editor: Please trash above ==================

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here