0

How can I trigger the PrtScn i.e, PrintScreen keyboard event through some jQuery function and then save that captured image to server?

function ErrorLog(errorCode, errorMessage) {

    // Here i want the screenshot of the user's screen where the error have occurred ...
    var _screenShot = "";

    SendErrorToServer(errorCode, errorMessage, _screenShot);
}

Can you guide me?

Krishn
  • 11
  • 1
  • 2
  • I do not believe that this is possible. "Print Screen" is an OS functionality and not accessible to the browser. I think the best you're going to be able to do is to send the contents of the html on their page. – Steven Hunt Sep 14 '12 at 12:23
  • I've gone gone through some links that talks about this, but they havn't provided any code for that. [https://developer.mozilla.org/en-US/docs/DOM/event.initKeyEvent#_Example_] – Krishn Sep 14 '12 at 12:27
  • The answer provided by @Muthu looks good, but I don't think you're going to be able to bind to the print screen key. Would some other key combination be acceptable? – Steven Hunt Sep 14 '12 at 12:31
  • Don't you think that it would be a pretty serious privacy violation if a random server could automatically take screenshots of your desktop? – Michał Politowski Sep 14 '12 at 12:37

1 Answers1

0

Maybe it can be done using HTML5 <canvas>.

http://html2canvas.hertzen.com/

Demo: http://html2canvas.hertzen.com/screenshots.html

Muthu Kumaran
  • 17,682
  • 5
  • 47
  • 70
  • in this scenario, we've to provide the link and then the image will be generated ... is there any way, such that the PrtScn keyboard button event triggered in and the captured image can be sent to the server ... ? – Krishn Sep 14 '12 at 12:33
  • Read this, http://stackoverflow.com/questions/4912092/using-html5-canvas-javascript-to-take-screenshots – Muthu Kumaran Sep 14 '12 at 12:38