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


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

<body>
<a href="view-source:http://www.rgagnon.com/examples/viewsource.htm">
  view my source</a>
</body>
</html>
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.


blog comments powered by Disqus