-1

I want to listen to an event whenever screenshot is taken from browser, is there any way available in Javascript where i can listen for captured screenshots

My original aim was to disable taking screenshot in my website, but i got to know that there are not any available solution to restrict user to take screenshot.

I am looking for solution to alter the captured screenshot by user in browser.

  • 3
    Most screenshot software runs outside the browser. That's not something you can control. – Felix Kling Jun 19 '23 at 11:11
  • You could listen for the printscreen keypress event. But I don't think it's possible to get any control on it from a browser. – Peterrabbit Jun 19 '23 at 11:18
  • @Peterrabbit Printscreen keypress event is also not handling, I have tried that. ` @HostListener('window:keyup', ["$event"]) loadKeyEvents(event: KeyboardEvent) { console.log(event.code, event.key, event.keyCode); }` – Chirag Thaker Jun 19 '23 at 11:33
  • Does this answer your question? [How do you detect a screen shot with js](https://stackoverflow.com/questions/67916474/how-do-you-detect-a-screen-shot-with-js) – Ivar Jun 19 '23 at 11:59
  • Even if you can prevent a screenshot, nothing prevents people from just saving your webpage, html and css source, all images... What are you trying to do? – Robert Jun 20 '23 at 02:30

1 Answers1

0

Not possible since the logic happens outside of the browser's scope. You could try checking for print screen key presses but that will immediately stop working as soon as the browser window looses focus.

As for this:

I am looking for solution to alter the captured screenshot by user in browser.

Completely out of the picture.

Lucián Blažek
  • 49
  • 1
  • 1
  • 7
  • If you see on many sites, after taking the picture you only got a white / black screen instead of your contents. ref: udemy.com – Chirag Thaker Jun 19 '23 at 12:07