"Chống copy hay quét khối trên blog"

Hình ảnh minh họa

1. Đăng nhập và vào bố cục
2. Chọn chỉnh sửa HTML (Edit HTML)
3. Sau đó hãy chọn code thủ thuật và chèn vào sau thẻ <head> hoặc trước thẻ </head>
- Đây là code chống quét khối văn bản
<script language='JavaScript1.2'>
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
- Đây là code chống sử dụng chuột phải
<script language='JavaScript'>
var msg="Welcome to TRAIDATMUI.COM";
function disableIE() {if (document.all) {alert(msg);return false;}
}
function disableNS(e) {
if (document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(msg);return false;}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;
} else {
document.onmouseup=disableNS;document.oncontextmenu=disableIE;
}
document.oncontextmenu=new Function("alert(msg);return false")
</script>
var msg="Welcome to TRAIDATMUI.COM";
function disableIE() {if (document.all) {alert(msg);return false;}
}
function disableNS(e) {
if (document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(msg);return false;}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;
} else {
document.onmouseup=disableNS;document.oncontextmenu=disableIE;
}
document.oncontextmenu=new Function("alert(msg);return false")
</script>
Tùy chỉnh: hãy thay dòng chữ màu xanh lá trong code thành dòng chữ mà bạn muốn người đọc thấy được khi click chuột phải trên blog bạn.
☼ Ngoài ra bạn còn có thể làm thêm một số thủ thuật nhỏ này:
- Chỉ cấm sao chép ở trang bài viết : thủ thuật này xem ra tiện lợi nhất, vì bạn chủ yếu chỉ cấm việc người xem copy nội dung cũng như hình ảnh của bài viết, vì thế ta áp dụng thủ thuật này chỉ ở trang bài viết, như thế sẽ không làm cho người đọc thấy bất tiện. Để thực hiện việc này, bạn chỉ cần thêm đoạn code ở bước 3 vào code màu đỏ bên dưới:
<b:if cond='data:blog.pageType == "item"'>
code bước 3
</b:if>
code bước 3
</b:if>
Bạn cũng có thể chỉ cho thủ thuật này có tác dụng ở trang chủ, tức là ở trang chủ ta không thể dùng chuột phải hoặc quét khối, nhưng ở những trang khác thì ta vẫn sử dụng được bình thường. Để thực hiện các bạn cũng làm tương tự như trên, tức là thêm đoạn code ở bước 3 vào code màu đỏ bên dưới:
<b:if cond='data:blog.url != data:blog.homepageUrl'>
code bước 3
</b:if>
code bước 3
</b:if>
Chúc bạn thành công
0 nhận xét:
Đăng nhận xét