Ads: (Please Click!)

Monday, March 09, 2009

Tutorial: How to disable highlights and right click


this javascript works both in Firefox and IE.. it will prevent user to highlight your text and right click to copy it.. i know there are plenty of ways to save the text even the right click button is disabled, but one of my friend insists me to put some minimal protection to their copyrighted text in the blog.. their argument is, make the copycat life harder.. hm..

if you have similar thinking, feel free to use the script below and you are able to apply it either your personal website or even your blog.. so, here for the solution..

<script type="text/javascript">

var omitformtags=["input", "textarea", "select"]

omitformtags=omitformtags.join("|")

function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}

function reEnable(){
return true
}

if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}

document.oncontextmenu=function(){ return false }

</script>


if you had a problem, don't hesitate to drop your comment.. i will reply you as soon as possible.. good luck!

PERHATIAN! Aktiviti PLAGIAT (copy & paste) sesuatu artikel tanpa pengetahuan dan kebenaran penulis adalah satu aktiviti/perbuatan yang TIDAK BERMORAL!

Ads: (Please Click!)
Comments
6 Comments


6 Orang Kentut Madu:

Uncle Dol said... [Reply]

not compatible for Safari & Opera web browser..

well I guess u've known that both can retrieve GMAIL's codes.. ;)

anyway.. nice tut..

ZahRa A!Sya said... [Reply]

ni mesti terer programming ni.kan?hehehe..erm..tau php tak?

aDuKa イスラム教 said... [Reply]

uncle dol: owh ok.. will fix it..

zahra: php x tau.. =P

Wan @ Jasper said... [Reply]

budok spike tau pasal php... budok jasper area jsp je @ java programming...

Wan @ Jasper said... [Reply]

jadi opera ngan safari ngan chrome boleh highlight dan copy la ye...

Kelab Pengguna SMK Membakut said... [Reply]

Assalamualaikum, Javascript tu nak letak dekat mana?

:fishbuuk.blogspot.com:

Post a Comment

Ruang komen telah di-set sebagai 'dofollow'. Sila tinggalkan URL blog anda dengan cara yang bijak. Baca DI SINI untuk mempelajari SEO mengenai 'dofollow' link.

Kepada ANONYMOUS, sila tinggalkan link dengan cara yang bermoral sedikit.

Terima kasih kerana sudi membaca artikel ini dan menurunkan komen anda.

 

Blog Aduka Copyright © 2011 -- Template created by O Pregador -- Powered by Blogger