-4

I'm trying to stop the screenshot event on mobile using JavaScript, because on PC is easier, I used only the event keyCode == 44 to stop.

Thanks a lot.

  • 2
    You can't. You can't do it on PC either. There's too many different ways to take pictures of the screen, including literally taking a picture of the screen. Even if you did implement something using JS, it could just be disabled using the console. – Carcigenicate Dec 18 '17 at 13:15
  • 2
    Heh. You didn't block anything on the PC. It's trivial to go around whatever blocks you try to implement. – JJJ Dec 18 '17 at 13:15
  • Possible duplicate of [How do I prevent an Android device from a taking a screenshot of my webpage?](https://stackoverflow.com/questions/31099410/how-do-i-prevent-an-android-device-from-a-taking-a-screenshot-of-my-webpage) – JJJ Dec 18 '17 at 13:21

2 Answers2

1

This is not possible, hence screenshot thing is iOS native features and independent to any app, you can not stop taking screenshot by coding for app.

Abhishek Mitra
  • 3,335
  • 4
  • 25
  • 46
0

You can prevent user from taking screenshots with Flags in Android

getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);

There is another solution for IOS devices where you can prevent taking screenshots programatically but I don't think there is a solution with JS.

EDIT: Those solutions for the applications not for a website!

Ege Kuzubasioglu
  • 5,991
  • 12
  • 49
  • 85