Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent users from copying content from website

Is there any way to prevent users from copying content from website and display encrypted code in view source?

I know that techies will always find a way but if it prevents normal users it's OK.

like image 694
Silas Paul Avatar asked May 31 '11 07:05

Silas Paul


People also ask

How do I disable copy on a website?

You can't ever disable it.. users can view the source of your page so the text is always available. If you put click handlers to disable right-click, they can turn javascript off.. The best you can try to do is make it inconvenient for people to deter them, but never can you prevent them.

Is it illegal to copy content from a website?

In general, the answer is no. This means you are claiming credit for someone else's work and is called plagiarism. It's illegal. If you publish someone else's work without the appropriate licence or permission you are committing copyright piracy. It's also illegal.

How do I disable copy in HTML?

You can use jquery for this: $('body'). bind('copy paste',function(e) { e. preventDefault(); return false; });


1 Answers

Check out ionCube HTML Obfuscator:-

http://www.ioncube.com/html_encoder.php

As of the text contents, Try this code:- Live Demo (IE isn't supported)

<script type="text/javascript">
document.oncopy = function(){
    var bodyEl = document.body;
    var selection = window.getSelection();
    selection.selectAllChildren( document.createElement( 'div' ) );
};
</script>
like image 184
Salman von Abbas Avatar answered Sep 28 '22 07:09

Salman von Abbas