Anyone knows how to disable copy function from the description in my magento website frontend?
is there any javascript can help please
Anyone knows how to disable copy function from the description in my magento website frontend?
is there any javascript can help please
You can listen to the mouse contextmenu and keydown event, prevent the context menu to show and prevent the default action if user press ctrl+c.
el.attachEvent('contextmenu', function(event){
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
// Some keys events require setting the keyCode to -1 to be prevented
try {
// all ctrl + X and F1 -> F12
if (event.ctrlKey || event.keyCode > 111 && event.keyCode < 124) {
event.keyCode = -1;
}
} catch (e) {}
}
});