Code Chống Bôi Đen Copy Bài Viết

Thảo luận trong 'Công Nghệ' bắt đầu bởi Wall-E, 27 Tháng sáu 2016.

  1. Wall-E

    Wall-E Active Member

    Bài viết:
    Tìm chủ đề
    135
    Để chống bôi đen toàn bộ trang web - ở bất kỳ vị trí nào các bạn chèn đoạn code sau vào trong thẻ body trong CSS

    Sử dụng CSS:

    Mã:
    -moz-user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    Nếu chỉ muốn chống bôi đen ở 1 vị trí cụ thể trong trang web thì các bạn cần xác định class CSS của vị trí đó bằng cách view source HTML rồi chèn nó vào class đó.

    Sử dụng Javascript:

    Mã:
    <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>
    Code javascript không cho click chuột phải:

    Mã:
    <script language='JavaScript'>
    var msg="Welcome to BlOg FD";
    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>
     
    Last edited by a moderator: 22 Tháng năm 2024
Từ Khóa:

Chia sẻ trang này

Đang tải...