Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
81
rated 0 times [  85] [ 4]  / answers: 1 / hits: 34958  / 13 Years ago, sat, december 3, 2011, 12:00:00

I know that it's impossible to thwart the world's most advanced minds, but I'd like to put the slightest of barriers on my website to keep my students from copying text from it and posting that text as their answer. (If they hand type it, that's ok).



I'm just so afraid of JavaScript because of cross browser inconsistencies.



Given that I have jQuery loaded and prefer to use jQuery whenever possible, how do I:




  1. Disable Ctrl + c

  2. Disable Menu Edit Copy.


More From » jquery

 Answers
4

Selecting text, copy, the right click can be disabled on a web page easily using jQuery. Below is the simple jQuery code snippet which can do this task easily:



<script type=text/javascript>
// Disable right click on web page
$(html).on(contextmenu,function(e){
return false;
});
// Disable cut, copy and paste on web page
$('html').bind('cut copy paste', function (e) {
e.preventDefault();
});
</script>


Source: Disable right click, copy, cut on web page using jQuery


[#88778] Thursday, December 1, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ignacio

Total Points: 467
Total Questions: 128
Total Answers: 79

Location: Luxembourg
Member since Tue, Mar 14, 2023
1 Year ago
ignacio questions
;