Microsoft KB Archive/188762

= How To Show Web Page Source from a Hyperlink =

Article ID: 188762

Article Last Modified on 5/11/2006

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q188762



SUMMARY
This article describes how to create a hyperlink on a Web page that shows the source code for the current page or another page when the hyperlink is selected.



MORE INFORMATION
Using an anchor tag with its associated HREF parameter, you can cause a hyperlink to display the source of a Web page when the hyperlink is clicked. To do so, set the value of the HREF parameter equal to "view- source:someFile.htm" where someFile.htm is the name of an HTML file that you want to show using the default editor for HTML source code.

Being able to display the source code of a Web page is valuable to those Internet Content Providers (ICPs) that wish to demonstrate how their pages have been created.

Please note that "view-source" works only on absolute links. Also, if you are trying to access an HTML file through the FILE protocol, you must fully qualify the URL like this:

Some Link

The following HTML code demonstrates how to show the source code for http://www.microsoft.com/ie40.htm when the hyperlink is pressed.   Show microsoft.com source code    Show microsoft.com/ie40.htm source code    NOTE: When you use this protocol a copy of the file is written to the temp directory.

