document.onkeydown = () => {
//禁用F12
if (window.event && window.event.keyCode == 123) {
return false;
} else if (window.event.ctrlKey && window.event.shiftKey && window.event.keyCode == 73) {
return false;
} else if (window.event.shiftKey && window.event.keyCode == 121) {
return false;
}
};
// 禁用右键
document.oncontextmenu = new Function(“event.returnValue=false”);
转自:
https://blog.csdn.net/qq_41531604/article/details/129125204