This article provides a summary of several methods to prohibit page content copying by using javascript and CSS. It is very practical. If you need it, you can refer to it. Method 1:
// Disable right-click menu, copy, and select $ (document). bind ("contextmenu copy selectstart", function () {return false ;});
Method 2:
// Disable Ctrl + C and Ctrl + V (supported by all browsers) $ (document ). keydown (function (e) {if (e. ctrlKey & (e. keyCode = 65 | e. keyCode = 67) {return false ;}});
Method 3:
// Set CSS to prohibit selection (this code is not required if the following CSS is written, supported by the new browser) $ (function () {$ ("body" ).css ({"-moz-user-select": "none", "-webkit-user-select": "none ", "-ms-user-select": "none", "-khtml-user-select": "none", "-o-user-select": "none ", "user-select": "none "});});
Method 4: Disable JavaScript and write it in CSS (supported by the new browser and gradually becomes a standard ):
Body {-moz-user-select: none;/* Firefox private attribute */-webkit-user-select: none; /* WebKit kernel private attribute */-ms-user-select: none;/* IE private attribute (IE10 and later) */-khtml-user-select: none; /* KHTML kernel private attribute */-o-user-select: none;/* Opera private attribute */user-select: none;/* CSS3 attribute */}