Using JS to prohibit copying text information

Source: Internet
Author: User

This article is mainly through the JavaScript implementation of the browser to prevent copying text content of the method, very simple, and compatible with IE and FF, the need for small partners can refer to the

Do SEO know that the original article on their own site optimization is very good, especially in the title of the search article, the original general ranking first. But optimization is for the search engine to see. And in the Internet has a very headache problem, an article on the search engine to the end who is original. This is not necessarily the same. As a simple example: for example, you have published a quality original article on your blog (assuming, of course, that your blog has a very low daily visit and hundreds of people per day). But not a few hours or days to be reprinted to a large portal site does not bring your article original connection, such as A5 this site. So after a period of time, you search the title of the article, who ranked first this is not easy to say. I have this kind of personal experience. For this reason, we insist that the original authors have the passion to continue to be original. Let's share a trick to teach you how to prevent Web content from being copied directly. Compatible with IE and Firefox. Okay, look at the code:

Copy the following JS code into your JS file (this code is for IE):

The code is as follows:
<script language= "JavaScript" >
Document.onselectstart=new Function ("event.returnvalue=false;"); Prohibit selection, i.e. cannot copy
</script>

Copy the following code into your CSS file (this code is for Firefox):

The code is as follows:
<style type= "Text/css" >body{-moz-user-select:none;} </style>

The above mentioned is the entire content of this article, I hope you can enjoy.

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.