Last active
August 29, 2020 06:39
-
-
Save tiglek/02ead288509c92b8efa5c2cc05d881e1 to your computer and use it in GitHub Desktop.
Re-enable the COPY from a copy-protected web page on a chrome browser
This file contains 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
// | |
// See https://github.com/FallenMax/chrome-extension-allow-copy/blob/master/extension/content_scripts/unlocker.js | |
// | |
((frame) => { | |
[ | |
'copy', 'cut', 'contextmenu', 'selectstart', 'mousedown', 'mouseup', 'mousemove', 'keydown', 'keypress', 'keyup' | |
].forEach(evt => { | |
frame.document.documentElement.addEventListener(evt, e => { | |
e.stopPropagation(); | |
e.stopImmediatePropagation && e.stopImmediatePropagation(); | |
}, { | |
capture: true, | |
}) | |
}); | |
const style = frame.document.createElement('STYLE'); | |
style.innerHTML = 'html,body,*,*::before,*::after { -webkit-user-select: initial !important; user-select: initial !important; }'; | |
frame.document.documentElement.append(style); | |
})(window); // or window['frame_id'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage