HTML页面禁止选择、页面禁止复制、页面禁止右键

HTML页面内容禁止选择、复制、右键

刚在一个看一个站点的源代码的的时候发现的,其实原来真的很简单

1
<body leftmargin=0 topmargin=0 oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' onselect='document.selection.empty()' oncopy='document.selection.empty()' onbeforecopy='return false' onmouseup='document.selection.empty()'>

关键就在

1
2
3
4
5
6
7
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>中加入如下的代码,这样鼠标的左右键都失效了.

1
topmargin="0" oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()"

1.禁止网页另存为:在<body>后面加入以下代码:

1
2
3
<noscript> 
<iframe src="*.htm"></iframe> 
</noscript>

2.禁止网页内容复制.粘贴:在<body>中加入以下代码:

1
<body onmousemove=/HideMenu()/ oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()">

 

html页面禁止用户右键粘贴复制保存的代码的更多相关文章

  1. HTML5 对于手机页面长按会粘贴复制的禁用 (解决方案)

    解决方案: 直接在CSS 文件中添加下面的代码,就可以实现了在手机端禁止粘贴复制的功能: *{    -webkit-touch-callout:none;  /*系统默认菜单被禁用*/    -we ...

  2. JavaScript 中禁止用户右键菜单,复制,选取,Ctrl,Alt,Shift. 获取宽高,清除浮动

    //禁用右键菜单 document.oncontextmenu = function(){ event.returnValue = false; } //禁用选取内容 document.onselec ...

  3. 禁止网页右键和复制,ctrl+a都不行。取消页面默认事件【全】。

    document.oncontextmenu=new Function("event.returnValue=false");document.onselectstart=new ...

  4. 利用js代码屏蔽f12,右键,粘贴,复制,剪切,选中,操作!!秀!秀!秀!

    koala 专注于个人技术分享 屏蔽f12审查 <script> document.onkeydown = function () { if (window.event && ...

  5. Html页面禁止鼠标左键复制

    <body leftmargin=0 topmargin=0 oncontextmenu='return false' ondragstart='return false' onselectst ...

  6. js禁止用户右键等操作

    <script type="text/javascript">    document.oncontextmenu=function(){return false};  ...

  7. JS禁用浏览器退格键、禁止右键、禁止全选、复制、粘贴

    一.禁用浏览器退格键 摘抄自:https://www.cnblogs.com/wanggd/p/3164536.html 我们在真实的项目开发中经常会使用JS 对键盘上的一些按键进行禁用,常见的比如说 ...

  8. HTML,JS禁止鼠标右键、禁止全选、复制、粘贴的方法

    禁止鼠标右键.禁止全选.复制.粘贴: oncontextmenu事件禁用右键菜单: js代码: document.oncontextmenu = function(){ event.returnVal ...

  9. js屏蔽浏览器右键菜单,粘贴,复制,剪切,选中(转)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

随机推荐

  1. element-ui 2.4.3 如何实现对form部分字段验证的解决方法?

    这是实际项目中的一个例子: 新增人员信息功能: 必填:姓名 .电话(验证电话格式): 非必填:备注.微信.邮箱(验证邮箱格式) 必填验证: 邮箱格式验证: 今天偶然看到 element-ui 2.4. ...

  2. 我最喜欢的Mybatis 3.5新特性!超实用!

    Mybatis 3.5 发布有段时间了,终于支持了 Optional ,这么实用的特性,竟然还没人安利……于是本文出现了. 新特性比较简单,但非常实用,因为能大量简化恶心的判空代码. WARNING ...

  3. C 语言多线程与锁机制

    C 语言多线程与锁机制 多线程 #include <pthread.h> void *TrainModelThread(void *id) { ... pthread_exit(NULL) ...

  4. [darknet]查看错误结果 sight of wrong

    import os import numpy import cv2 bad_label_file = open("bad_valid.list",'r') names = [] f ...

  5. spring-IoC的配置文件applicationContext.XML

    <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...

  6. Bootstrap各种进度条的实例讲解

    本章将讲解 Bootstrap 进度条.在本教程中,您将看到如何使用bootstrap教程.重定向或动作状态的进度条. Bootstrap 进度条使用 CSS3 过渡和动画来获得该效果.Interne ...

  7. 解决Win10 PowerShell无法激活Anaconda环境的问题

    最近在使用Anaconda的过程中,发现在Win10的PowerShell在使用conda activate 环境名激活环境时无效,而CMD则可以.这里前提必须将Anaconda 写入环境变量.否则在 ...

  8. LOJ 2409「THUPC 2017」小 L 的计算题 / Sum

    思路 和玩游戏一题类似 定义\(A_k(x)=\sum_{i=0}^\infty a_k^ix^i=\frac{1}{1-a_kx}\) 用\(\ln 'x\)代替\(\frac{1}{x}\), 所 ...

  9. IOS 模块并且发布到NPM

      注释:导入出错 请使用这个 #import <React/RCTBridge.h>   参考文档:http://www.liuchungui.com/blog/2016/05/02/r ...

  10. 处理npm publish报错问题

    上传项目到npm-->为社会做贡献 首先你得有一个项目 npm init 生成package.json 来设置相信息 注册登录npm:npm adduser 输入你的一些信息 查看当前npm登录 ...