Matt Sinclair
Matt Sinclair

Reputation: 1102

Capturing a desktop screenshot with javascript

Is it possible to capture a screenshot of the client's windows desktop using javascript? What about in linux and mac OS?

Clarification

This question has not been asked or answered, because I'm looking to capture the entire desktop, not just the browser. I would also like to capture 'native' screenshot rather than one that is recreated from some underlying representation (which would be impossible on any OS).

Upvotes: 6

Views: 3706

Answers (2)

ajorquera
ajorquera

Reputation: 1309

There is an API called getDisplayMedia that lets you capture screen contents as a live MediaStream. It doesnt have a lot of support in browsers though.

https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API/Using_Screen_Capture

If you just want a screenshot, you should be able to find a way to extract just a frame from the streaming video. Check this answer

Upvotes: 1

Alessandro Minoccheri
Alessandro Minoccheri

Reputation: 35973

Exist a plugin that you can configure the image that you want to take or part of element of your DOM like the body or a particular div.

Plugin is: HTML2CANVAS

Upvotes: 0

Related Questions