Google's "Report a Bug" or "Feedback Tool" lets you select an area of your browser window to create a screenshot that is submitted with your feedback about a bug.

Google Feedback Tool Screenshot screenshot by Jason Small, posted in a duplicate question.



How are they doing this? Google's JavaScript feedback API is loaded from here:
https://ssl.gstatic.com/feedback/api.js
Their overview of the feedback module will demonstrate the screenshot capability:
http://www.google.com/tools/feedback/intl/en/learnmore.html


JavaScript can read the DOM and render a fairly accurate representation of that using canvas. I have been working on a script which converts html into an canvas image. Decided today to make an implementation of it into sending feedbacks like you described.
The script allows you to create feedback forms which include a screenshot, created on the clients browser, along with the form. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.
It does not require any rendering from the server, as the whole image is created on the clients browser. The HTML2Canvas script itself is still in a very experimental state, as it does not parse nearly as much of the CSS3 attributes I would want it to, nor does it have any support to load CORS images even if a proxy was available.
Still quite limited browser compatibility (not because more couldn't be supported, just haven't had time to make it more cross browser supported).
For more information, have a look at the examples here:
http://hertzen.com/experiments/jsfeedback/
edit The html2canvas script is now available seperately here and some examples here.

 Ref: http://stackoverflow.com/questions/4912092/using-html5-canvas-javascript-to-take-screenshots