Click here to Skip to main content
15,886,835 members
Articles / Web Development / HTML
Article

View Source of ShowModalDialog

Rate me:
Please Sign up or sign in to vote.
3.31/5 (19 votes)
12 Sep 2005 64.4K   14   7
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


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralGracias Pin
Homoplato14-Jul-09 21:51
Homoplato14-Jul-09 21:51 
GeneralThanks Pin
inkcolorYui20-Jul-07 0:56
inkcolorYui20-Jul-07 0:56 
GeneralReally good script Pin
BlackDalamar8-Mar-07 9:32
BlackDalamar8-Mar-07 9:32 
GeneralThanks Saved me time Pin
mstul01s5-Jan-07 4:13
mstul01s5-Jan-07 4:13 
GeneralThis is Great Pin
Tonyv75121-Sep-06 6:20
Tonyv75121-Sep-06 6:20 
GeneralWhy not just open the window regularly Pin
daddion13-Sep-05 2:10
daddion13-Sep-05 2:10 
GeneralRe: Why not just open the window regularly Pin
FlashMerlot13-Sep-05 6:15
FlashMerlot13-Sep-05 6:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.