0

I have noticed some web pages have somehow implemented a feature to prevent a screen capture of some regions of that web pages. By taking a screenshot of that webpage, instead of some regions that I can normally see live in a browser (Chrome), on a screenshot I can only see a black frame. Firefox doesn't seem to have this "feature" - screenshots are taken normally without black frames.

Example of such site is Netflix. It's not possible to take a screenshot (by "print screen" key on keyboard) of the running movie from Chrome (last update) on a desktop PC running Windows 11. The video controls (play/pause, video position bar ...) are visible, but the video itself is not (black frame).

What kind of javascript functionality/API is capable of this?

user10099
  • 1,345
  • 2
  • 17
  • 23
  • 2
    Could you list these webpages for us so we can inspect them? – Salim Nov 04 '22 at 10:48
  • 1
    I would rather not, but if no one has any idea, we'll see – user10099 Nov 04 '22 at 10:56
  • 1
    You cant prevent screenshot's, it's on OS thing, has nothing to do with the browser – 0stone0 Nov 04 '22 at 10:58
  • 1
    Does this answer your question? [What are the ways to prevent users to take screenshot of a webpage?](https://stackoverflow.com/questions/12429439/what-are-the-ways-to-prevent-users-to-take-screenshot-of-a-webpage) – 0stone0 Nov 04 '22 at 10:58
  • @0stone0 in that question you posted, there is a interesting comment to first answer about Netflix being able to block the screenshots. so apparently there is some way how to block that in a Chrome browser. – user10099 Nov 04 '22 at 11:04
  • and yes, I can confirm, that Netflix behaves same for me. I can't take the screenshot of movie on Chrome, but I can take it on Firefox. But the question still remains - what is the API behind this? Any documentation? – user10099 Nov 04 '22 at 11:06
  • 1
    @user10099 Which Operating System are you on? Which device are you on? How are you triggering the screenshot (many ways on desktop, not so many on mobile)? Please add those details to your question. – cachius Nov 04 '22 at 16:15
  • @cachius Thanks for advice, question updated – user10099 Nov 04 '22 at 16:20

1 Answers1

1

Limiting screen capture is called "Digital Right Management" from a vendor's perspective. From a user's perspective it's more like "Enduser Device Control".

It's scope of the Video Playback Pipeline, not JavaScript. JavaScript only facilitates key exchange so that you can decrypt the video locally. Depending on properties that can be ascertained to the video provider about your system, the quality of the video can be limited. Browsers will mostly only receive SD quality. Here's a JS snippet to enumerate the supported CDMs of your browser.

Regarding screenshot prevention: If it's not built into the OS, it will be a custom implementation like here(code) that will not prevent all possibilities to take a screenshots, e.g. using a 3rd party program. For Chrome it is said to be tangled to hardware acceleration, turn that off and screenshots are possible.

Though nothing can guard content against recording in the analog hole, though at least to prevent distribution of such recordings video providers add watermarks on a per user basis.

If you want to go the DRM route, see here for a simple scheme to setup yourself or contact one of the authorized Widevine partners to go for the L1 hardware level.


For further reading, DRM on Android is well documented and has some diagrams:

cachius
  • 1,743
  • 1
  • 8
  • 21