Chris Coyier show us from his tutorial ‘How to Make a View Source Button Using CSS3 and jQuery for Demo Pages’. Click it, and you see the entire source code for the page you are looking at. It’s not a popup or a new tab, it just shows the source right there on the page. It works Pretty much everything modern, as long as it supports CSS3 :target. Breaks in IE 8 and down, but OK in IE 9.
Demo : http://css-tricks.com/examples/ViewSourceButton/
Download : http://css-tricks.com/make-a-view-source-button/
Requirements : jQuery & CSS3