禁止網頁複製保存

若是你想讓你的網站內容不被別人複製,能夠看看下面的實現方法:javascript

//禁止鼠標右鍵java

$(document).bind("contextmenu", function(e) {網站

    return false;.net

});orm

//禁止鍵盤按鍵:ip

<script type="text/JavaScript">get

      function key() {input

          if (event.shiftKey) {iframe

              window.close();it

          }

          //禁止Shift

          if (event.altKey) {

              window.close();

          }

          //禁止Alt

          if (event.ctrlKey) {

              window.close();

          }

          //禁止Ctrl

          return false;

      }

      document.onkeydown = key;

</script>

<!-- 禁止選中內容 -->

<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

    } 

</script>

JS禁止網頁複製和拷貝,只須要在body中加入部分代碼便可

<body oncontextmenu="return false" onselectstart="return false"  oncopy="return false">

還有另一種方法,除了禁止另存外,其它功能基本上搞定:

<body oncontextmenu="return false" ondragstart="return false" onselectstart="return false"

    onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"

onmouseup="document.selection.empty()">直接加在body標籤裏便可

 

<!--禁止網頁另存爲: -->

<noscript>

    <iframe src="/*"></iframe>

</noscript>

相關文章
相關標籤/搜索