Share this page 

Make a link to see the source of a pageTag(s): HTML/CSS

See this
<title>view-source demo</title>

<a href="view-source:">
  view my source</a>
You have to specify the full "path", relative url won't work with the view-source protocol.

With some Javascript, you can bypass this limitation if the "full" path is not known.

<a href="example1.htm" onclick="location.href = 'view-source:' 
  + this.href; return false">example1.htm</a>
Try it here

Thanks to John Taylor-Johnston for this tip.