On copy prevention in HTML, part 1

Migrated from my old blog; originally posted 4/8/2007

Many web developers like to prevent their viewers from copying their text. While I do not approve of this, there are cases where it is appropriate.

The simplest way to achieve this is to use the IE only attribute UNSELECTABLE and the FireFox only css style -moz-user-select. Such HTML looks like this:

<DIV unselectable="on"
style="-moz-user-select:none;">
You can't select me.
</DIV>
You can't select me.

To make the HTML and CSS validate, one could do this in Javascript: Elem.unselectable = "on"; Elem.style.MozUserSelect = "none";

However, this method only works in IE and Firefox. In addition, in IE, it doesn't work very well, and if a user tries hard, he will end up selecting the text.

A slightly better way to do it is to handle the onselectstart event (for IE) and the onmousedown event (for everything else) and return false. This will prevent the browser from handling the events. This results in something like this:

<DIV
onselectstart="return false;"
onmousedown="return false;" >
You can't select me.
</DIV>
You can't select me.

The problem with these methods is that they do nothing to prevent a user from reading the HTML source. This is discussed in the next part.

8 comments:

It's nice that there are such blogs. Karina

It will be great idea for college students to read information from https://eduessayhelper.org/blog/sat-score. Here you can read how to get higher SAT score

Hi there! I am extremely proud that our generation is so positive about innovative technologies, thank you for sharing great content. It is wonderful to watch this. To develop our talents, we need to learn something new every day of our life. In our time, learning has become both more difficult and easier, harder because curriculum is improving but the level of necessary knowledge is growing. It’s easier because the guys from https://bestresearchpaper.com/ continue to help students solve problems of varying complexity.

really that is the benefit for all people you do it. last week I had contact Report Writing Help service he provides like your help but he provides educational help.

Information from Take My Online Accounting Class will help you to get perfect student help. I had such experience recently

When you realize that you can learn this in a day rather than the month or more that professors teach it for. It truly does make a difference ghostwriting company when you have a good explanation and a high degree of understanding.

Nothing personal perhaps, someone like me would need my feedback on this service that I used to write an abstract and essay. It’s quite difficult to be a student and keep up with everything, and the older the course, the more difficult and difficult the tasks, and so there is not enough time for this, well, this is a disaster. Based on reviews, I chose these guys freepaperwriter com and I am very glad that my intuition did not disappoint. Indeed, we can recommend them as competent performers who perform their work efficiently and on time.

Copy prevention in HTML involves using techniques like disabling right-click, blocking text selection, or using watermarked images to protect content. For a career boost explore our website professional CV writing services in UAE.

Post a Comment