Javascript: Prohibit the copying of webpage content summary, javascript webpage content

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.