I want to copy some content from a website that has copy disabled by this part
$(document).bind('copy', function(e){
return false;
});
I tried to unbind the function with $(document).off('copy')
, and it works flawlessly in the console, but when in userscript it does not work.
I used Tampermonkey userscript to create a button to copy all content from a class with these lines
// Everything in this code block works in the console...
$(document).off('copy');
range.selectNode(document.getElementsByClassName('bbWrapper')[0]);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand('copy');
window.getSelection().removeAllRanges();
Already have this in header // @require https://code.jquery.com/jquery-3.6.0.min.js
Also done this var $ = window.jQuery;