There is experimental support for full-screen capture in Chrome's getUserMedia
WebRTC function, using a {chromeMediaSource: 'screen'}
parameter. The functionality currently requires explicit activation by an option in chrome://flags
, and (like all WebRTC capture mechanisms) requires explicit consent from the user when the function is called.
Other than that experimental option in Chrome, is not possible using pure JavaScript, but you could probably do it using a plugin like Flash, or an ActiveX control.
If you only want to capture a web page (rather than the whole screen), see Using HTML5/Canvas/JavaScript to take screenshots.