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. mysql时间相加函数DATE_ADD()

    mysql中的DATE_ADD()函数 1.定义:函数向日期添加指定的时间间隔. 2.语法:DATE_ADD(date,INTERVAL expr type) date 参数是合法的日期表达式.exp ...

  2. Git_GitHub-使用过程遇到的问题——坑(持续添加)

    push错误——>master git push -u origin master 最后找到解决办法如下: 1.先删除远程 Git 仓库 $ git remote rm origin 2.再添加 ...

  3. JS引擎的执行机制:探究EventLoop(含Macro Task和Micro Task)

    在我看来理解好JS引擎的执行机制对于理解JS引擎至关重要,今天将要好好梳理下JS引擎的执行机制. 首先解释下题目中的名词:(阅读本文后你会对这些概念掌握了解) Event Loop:事件循环Micro ...

  4. hibernate HQL添加语句

    1.Hibernate HQL添加语句 save();方法使用HQL语句来完成插入操作是不能实现的,不管你使用insert into....values...还是insert into.....sel ...

  5. 单元测试系列之五:Mock工具之Mockito实战

    更多原创测试技术文章同步更新到微信公众号 :三国测,敬请扫码关注个人的微信号,感谢! 原文链接:http://www.cnblogs.com/zishi/p/6780719.html 在实际项目中写单 ...

  6. MyBatis Generator 自定义生成注释

    注释生成器 为了生成db里面的注释,必须自定义注释生成器 EmptyCommentGenerator: import org.mybatis.generator.api.CommentGenerato ...

  7. 使用MySQL workbench 和Excel表之间的数据互相导出

    导出数据是很常用的功能,但今天在操作时遇到了一点问题,记录下来,方便其他人查阅. 1. 使用MySQL workbench 导出数据 在workbench里连接好数据库之后直接点击左侧的managem ...

  8. HTTP 方法:Get与Post分析

    GET - 从指定的资源请求数据 POST - 向指定的资源提交要被处理的数据 GET 方法 GET 请求可被缓存 GET 请求保留在浏览器历史记录中 GET 请求可被收藏为书签 GET 请求不应在处 ...

  9. 微信小程序外包 就找北京动软 专业承接微信小程序定制

    很多人问为什么要开发微信小程序,微信小程序的“入口”在哪儿? 1.只有访问过的小程序,才会出现所谓的「入口」. 所有访问过得小程序都可以从微信首屏下面的「发现」点过去.(必须是最新版微信) 这个所谓的 ...

  10. pycharm安装配置

    激活 教程https://blog.csdn.net/u014044812/article/details/78727496 推荐修改host文件的方法 配置 https://blog.csdn.ne ...