How can I edit this piece of code so that the right- click and the context-menu that have been disabled are re-enabled? I have no knowledge of javascript or any other back-end language. This code is from my university's javaelab website in which they have disabled right click and copy paste.
$.ajax({
type: 'POST',
url: '../flag.checker.php',
success: function(codedata) {
if(codedata == 1) {
console.log("Diasble");
$("body").on("contextmenu",function(e){
window.alert("NOT ALLOWED");
return false;
});
$('body').bind('cut copy paste', function (e) {
e.preventDefault();
window.alert("NOT ALLOWED");
return false;
});
editor.on('paste',function(e){
e.preventDefault();
console.log('Paste is clicked');
});
editor.on('beforeChange',function(instance,changeObj) {
if(changeObj.origin == "paste") {
window.alert("NOT ALLOWED");
changeObj.cancel();
}
});
}
}
});
How can I edit this piece of code so that the right- click and the context-menu that have been disabled are re-enabled? I have no knowledge of javascript or any other back-end language. This code is from my university's javaelab website in which they have disabled right click and copy paste.
$.ajax({
type: 'POST',
url: '../flag.checker.php',
success: function(codedata) {
if(codedata == 1) {
console.log("Diasble");
$("body").on("contextmenu",function(e){
window.alert("NOT ALLOWED");
return false;
});
$('body').bind('cut copy paste', function (e) {
e.preventDefault();
window.alert("NOT ALLOWED");
return false;
});
editor.on('paste',function(e){
e.preventDefault();
console.log('Paste is clicked');
});
editor.on('beforeChange',function(instance,changeObj) {
if(changeObj.origin == "paste") {
window.alert("NOT ALLOWED");
changeObj.cancel();
}
});
}
}
});
Share
Improve this question
edited Feb 25, 2017 at 19:36
Sebastian Zartner
20.1k10 gold badges102 silver badges141 bronze badges
asked Feb 25, 2017 at 17:26
AkshitAkshit
71 gold badge2 silver badges3 bronze badges
1
- 1 Do you want to edit this code or adding another code to stop those effects? – Mouneer Commented Feb 25, 2017 at 17:39
2 Answers
Reset to default 5In the address bar of your browser, type:
javascript: $( "body" ).off();
And press enter. If the copy paste doesn't work:
javascript: $( "body" ).off("cut copy paste", "**");
You don't really want to edit the code, you want to simply remove all of it, as it's all designed to prevent copy and paste.
If this is a site that you want to copy and paste from but can't modify the source (e.g. You're not hosting it) then your easiest route would to be to use a Web proxy (e.g. Telerik Fiddler) and add a custom response to that request - essentially returning 0
whenever a request is made to something ending in flag.checker.php
. This wonderful approach requires no code changes.