zoukankan      html  css  js  c++  java
  • 禁止网页右键、复制、另存为方法

       乐趣而生!

    从零开始

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>禁止右键菜</title>
    </head>

    <body>
    <script type="text/javascrpt" language="javascript">
    //方法一   禁止网页右键、复制、另存为、查看源文件等功能实现网页源代码保护,总结出如下几种方法实现对网页的简单保护,具体代码如下:
    //1、禁止右键菜单
    function noMenuOne()
    {
    alert('禁止右键菜单!');
    return false;
    }
    document.oncontextmenu = noMenuOne;
    //方法二
    function noMenuTwo()
    {
    if(event.button == 2)
    {
    alert('禁止右键菜单!');
    return false;
    }
    }
    document.onmousedown = noMenuTwo;
    </script>
    2、禁止复制(Ctrl+C)
    复制代码
    <script type="text/javascript" language="javascript">
    function noCopy()
    {
    alert("禁止使用Ctrl+C进行复制操作!");
    event.returnValue = false;
    }
    </script>
    //<body oncopy = "noCopy()">
    3、禁止另存为
    复制代码
    <!--在<body></body>之间加入代码 -->
    <noscript><iframe src='*.htm'></iframe></noscript>
    4、禁止缓存
    禁止缓存 在页面中使用如下HTML标记:
    复制代码
    <HEAD>
    <META http-equiv=Pragma content=no-cache>
    <META http-equiv=Cache-Control content=no-cache>
    <META http-equiv=Expires content=0>
    </HEAD>


    </body>
    </html>

  • 相关阅读:
    RPM包校验和提取
    RPM包查询
    Find命令简介
    无法启动配置好的虚拟机
    文档发布至博客操作说明
    VMware Virtual Machine安装报错解决1
    python create home dircetory
    Centos7/Active Directory authentication using nss-pam-ldapd
    java try后面括号的作用
    vps上搭建jupyter notebook远程服务
  • 原文地址:https://www.cnblogs.com/su1637/p/8257751.html
Copyright © 2011-2022 走看看