This is your first visit to this page. Welcome!

Khamis, 17 Mac 2011

Tutorial : Elak content di copy


Korang tak suka post korang kena copy? Di sini ada satu tutorial macammana untuk korang halang daripada post korang dicopy sewenang-wenangnya. Dengan memasang script Disable text selection, ianya akan menghentikan serta merta fungsi select dan juga Ctrl+C. Jom terjah sikit...


1. Pergi ke Dashboard >Layout >Add A Gadget >HTML/Javascript.
2. Copy code di bawah ni dan letakkan pada HTML/Javascript.


<script type="text/javascript">
/***********************************************
* Disable Text Selection script- &#169; Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
target.style.MozUserSelect="none"
else //All other route (ie: Opera)
target.onmousedown=function(){return false}
target.style.cursor = "default"
}

//Sample usages
//disableSelection(document.body) //Disable text selection on entire body
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"
</script>
<script type="text/javascript">
disableSelection(document.body) //disable text selection on entire body of page
</script>


3. Save dan lihatlah hasilnya.


Note : Untuk makluman, tutorial ini hanya terpakai untuk teks sahaja tau, untuk image still boleh di copy dengan fungsi right click. Salah satu cara kalau korang tak nak gambar dicuri, letak signature kt gambar korang tuh. Sure tak ada orang amik..huhuhu......

Good Luck!

lepak.com.my

About lepak.com.my

lepak.com.my ini diwujudkan bagi berkongsi info, petua, resepi,tempat menarik yang kami lawati dan lain-lain dengan anda. Di lepak kami sangat mengalu-alukan sebarang pandangan dan berkongsi apa jua isu bersama anda semua

Subscribe to this Blog via Email :

Comments (11)

Loading... Logging you in...
  • Logged in as
nur atiqah's avatar

nur atiqah · 732 weeks ago

cm ne nk pop up jgn bg org amik gmbar kte plak??
boleh guna disable right click tapi still boleh copy bila klik pada gambar. Saya pun masih mencari macammana nak protect dari gambar diambil....
tq share info ni :)
My recent post auwww- birooooo nya mataku -
1 reply · active 732 weeks ago
sama2....ilmu kena kosngsi sama2 kan....:)
My recent post Dia Dah Berkahwin Dengan 29 Wanita!
Hi admin,
thanks for the sharing.. saya baru nak berjinak2 dgn blog.. nak tanya.. kalau dah buat lepas tu kita tukar2 template,
then tak boleh nak buang pulak skrip tu sebab dah tak jumpa dia punya fungsi HTML tu.. macamanalah? kalau sesiapa di sini tahu blh bantu saya?

thanks
My recent post Selamat Hari Kemerdekaan Malaysia ke- 56
2 replies · active 602 weeks ago
eh Chops!
saya dah berjaya settlekan masalah tu..
godek2 rupa2nya HTML code ada tp nama 'Title HTML' tu dah jadi lain..

ok tq2 yer..
My recent post Selamat Hari Kemerdekaan Malaysia ke- 56
singgah sini n sy gne tuto ney kat blog sy =)

Post a new comment

Comments by