Wednesday, June 11, 2008

Disable Copy/Paste ...


Add these attributes to the BODY Tag to disable copy/paste everywhere on the page...

<body ondragstart='return false' onselectstart='return false'>

or better still add this script to the JavaScript section in the HEAD of your page...
" document.body.ondragstart = 'return false' ; "
" document.body.onselectstart = 'return false'; "

3 comments:

mysterious said...

Hey Dani,

Very useful blog.
I liked disable right click / disable copy paste.

Keep writing..
I will keep visiting..

baskCoder said...

Pressing Ctrl+A enables selecting of text. Is there any way to disable keyboard shortcuts (Ctrl+A, Ctrl+C and Ctrl+v)?

Thank you :-)

sai said...

Please try this

<script language="javascript" type="text/javascript">
document.onselectstart=new Function('return false');
function ds(e){return false;}
function ra(){return true;}
document.onmousedown=ds;
document.onclick=ra;
</script>