Created
March 7, 2024 06:18
-
-
Save iamrealfarhanbd/a6997ef13dd91bc47ab2e2ac59e6c3b2 to your computer and use it in GitHub Desktop.
This Gist provides CSS and JavaScript code snippets to prevent users from copying content from a webpage by disabling text selection and right-click context menu. These measures can serve as a deterrent against unauthorized copying of website content. You can choose to implement either the CSS or JavaScript solution based on your preference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable text selection with css | |
#footable_parent_NT_ID { | |
user-select: none; | |
-moz-user-select: none; | |
-webkit-user-select: none; | |
pointer-events: none; | |
} | |
/********************* | |
or | |
*********************/ | |
// Disable right-click context menu | |
document.addEventListener('contextmenu', function(e) { | |
e.preventDefault(); | |
}); | |
// Disable text selection | |
document.addEventListener('selectstart', function(e) { | |
e.preventDefault(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment