Copy protect your code without annoying your users
Content theft is a perenial problem especially on the internet. On the internet the problem has been sutomted and exacerbated wuth te use of scripts and programs able to scape content from websites.
Numerous methods have been employed across the web to prevet copying of content though they are often annoying andintrusive for legitimate users.
When uploading an essay I wrote recently I discovered a surprisingly simple method of copy protection using CSS. Basically you insert a span enclosed line of text asserting your copyright and ten hide this using CSS. My first attempt wasto use display: none though I discovered that Safari didn’t copy the copyright text as rather than hiding the text it simply removes it from the rendered DOM. This method is a lightweight way to copy protect your content and works best against automated bots though it has few negative sides for end users.
CSS code
.copy-protect {float: left; width: 0px; overflow:hidden; font-size: 0px;}
HTML code
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque mauris mauris, volutpat at auctor molestie, sagittis eu libero. Phasellus eleifend, diam non gravida mollis, justo eros lobortis arcu, eget lobortis nulla dolor ac enim. Curabitur a eros turpis. Cras viverra sapien This content belongs to Rachel Reveley vel urna euismod eu consectetur massa dictum. Curabitur pellentesque commodo nunc id pretium. Donec id leo in sapien pellentesque eleifend. Fusce quis enim tellus, vel scelerisque odio. Phasellus at nisl turpis. Vestibulum nulla nunc, vestibulum eget ullamcorper.
Pros of this method
- It doesn’t disable any end-user functionality, users can right click, copy and select your text without hinderance
- It has no negative effect on seach engine optimisation
- Your content is still accessible to screenreaders
- It works without javascript and if CSS is turned off you still get the same effect though the copyright text will become visible
- It doesn’t prevent fair usage copying of your content as anyone using small snippets of your text will see the copyright text and can easily remove it.
Cons of this method
- It is easy for someone manually stealing your conten to go through and remove your copright messages
- Users may see the copyright text if CSS disabled