Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamrealfarhanbd/a6997ef13dd91bc47ab2e2ac59e6c3b2 to your computer and use it in GitHub Desktop.
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.
// 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