Javascript: Prohibit the copying of webpage content summary, javascript webpage content
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 */}
Articles you may be interested in:
- Javascript prohibit webpage copying
- The website content cannot be copied, pasted, or saved as JavaScript code.
- Prohibit copying webpage content using javascript
- Prohibit text copying using js
- JavaScript code allows you to easily prohibit copying webpage content (simple code)