Created
July 3, 2024 16:39
-
-
Save mehmetabak/e7ac85d448f7a8829e8df7e47bb473c6 to your computer and use it in GitHub Desktop.
Don't Tread on Me / A little code that can be used on websites that prevent pasting
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
| function dontTreadOnMe(e) { | |
| e.stopImmediatePropagation(); | |
| } | |
| function addEventListenerToPreventDefault(eventType) { | |
| document.addEventListener(eventType, dontTreadOnMe, true); | |
| } | |
| addEventListenerToPreventDefault("paste"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment