Script to Disable Mouse Right Click
- <script type="text/javascript">
- $(document).ready(function() {
- $(".disableEvent").on("contextmenu",function(){
- alert('right click disabled');
- return false;
- });
- });
- </script>
Script to Disable Cut Copy & Paste
Using this script, you can prevent user to cut (CTRL+X), copy (CTRL+C) and paste (CTRL+V)content from your web pages.
- <script type="text/javascript">
- $(document).ready(function() {
- $('.disableEvent').bind('cut copy paste', function (e) {
- e.preventDefault();
- });
- });
- </script>
-
As far as I can see, the secret sauce is, that Ctrl+S does NOT fire the keypress event, only the keydown event.
$(document).bind('keydown', 'ctrl+s', function(e) {
e.preventDefault();
alert('Ctrl+S');
return false;
});
Only with jQuery:
$(document).bind('keydown', function(e) {
if(e.ctrlKey && (e.which == 83)) {
e.preventDefault();
alert('Ctrl+S');
return false;
}
});
Disable saving web page with CTRL-S using JQuery
Use below JQuery code to disable saving web page using "CTRL-S" keyword
directly. This will work well on all browser (IE, Firefox, Google
chrome).
// To prevent saving web site directly using "ctrl-s"
$(document).bind('keydown keypress', 'ctrl+s', function () {
$('#save').click();
return false;
});
No comments:
Post a Comment