Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Akhter Rasool
8,597 Pointspreventing screenshot
can i prevent user from taking screenshot of my webpage? If yes, please could you tell me what technology i can use ?
2 Answers

Kristopher Van Sant
Courses Plus Student 18,830 PointsAhh I see. Well that is a challenge. Sounds like there's a student problem there haha. Well, you might have to make it so that the assignments are only visible to the professor. Once the student submits the assignment the professor could login to the site and see all of their assignments. This way the students couldn't just go to the website and see all of the assignments and copy them. If you did this they might still be able to copy the text they just typed and send it to a friend. But then you could possibly disable the copy shortcut from the keyboard, shown here http://stackoverflow.com/questions/19829078/disable-ctrla-ctrlc-key-functions-to-html-page . Sounds like a sticky situation though! I'm sorry that I can't be a bigger help here.

Kristopher Van Sant
Courses Plus Student 18,830 PointsI believe you can disable the print screen button on the keyboard but you cannot prevent users from taking screenshots. I'm also not sure why you would want to prevent users from taking screenshots of your page in the first place. If you're worried about someone stealing photos or your design or something else, preventing screenshots would not stop them as they could easily take a picture of the screen with a camera or access content some other way. In regards to photos or images you could also consider adding watermarks to them.
Here's a few links that talk about this further and why it's not possible: http://stackoverflow.com/questions/12429439/what-are-the-ways-to-prevent-users-to-take-screenshot-of-a-webpage
Hope this helps! :)

Akhter Rasool
8,597 Pointshow can watermarks help ?

Akhter Rasool
8,597 PointsCan i at least hide the contents when the website detects that the user is taking a screenshot ?

Kristopher Van Sant
Courses Plus Student 18,830 PointsWhat sort of content are you trying to protect? Is it images or art? Watermarks are sometimes used to place a "stamp" on the photo to let others know that the photo belongs to you. If someone downloads the image from your site or takes a screenshot of it it will have the watermark on it as a way to show where it came from. Here's a few resources that discuss the pros and cons of using watermarks.
http://www.natezeman.com/gallery/watermarks/
https://www.slrlounge.com/should-you-watermark-images/
https://fstoppers.com/business/debate-over-watermarks-photography-77352
http://www.wix.com/blog/2014/08/how-to-easily-watermark-and-protect-your-images/
http://reddotblog.com/debate-should-you-watermark-images-you-are-posting-online/
You cannot hide web content if someone is taking a screenshot. Screenshots are "controlled by software running on a user's operating system and cannot be remotely controlled by a web server" (from JSK on this stack overflow post ) .
In my personal opinion, if you are that concerned with someone stealing content from your site and are trying to go through all this trouble, then maybe that content shouldn't be shared on the web for the whole world to see and access. Sadly, no matter what you do to try and "protect" your content, if someone wants to steal it that bad they will find a way around whatever blockers are put up.
If it is images or art or photographs that you're trying to protect I think watermarks will be what you want to use.

Akhter Rasool
8,597 PointsI actually am working on a project, in which students will have to type their college assignments on a website and submit it to professor there and then itself, but most of the students will copy the assignment of others,(either by taking screenshot or by taking a photo, and sending that image to other friends who will directly copy from that image) and i want to prevent students from copying. Will it be a good idea to keep the textarea short so that it'll be difficult to capture many screenshots ?
Akhter Rasool
8,597 PointsAkhter Rasool
8,597 PointsAnyways, Thank you so much for your responses, they were useful
Kristopher Van Sant
Courses Plus Student 18,830 PointsKristopher Van Sant
Courses Plus Student 18,830 PointsNo problem at all, always happy to help.