来由很简朴,网站辛勤清算的内容不想被人轻易copy了,虽然针对的是平凡用户,查察源文件这个榨取还不是很轻易实现.只是榨取了右键菜单,榨取了一些键盘按键,及选中文本,另存网页根基成果.
起首榨取右键,行使了jquery,很简朴:
//榨取鼠标右键 $(document).bind("contextmenu", function(e) { return false; }); 再就是可以榨取键盘按键:
<script type="text/javascript"> function key() { if (event.shiftKey) { window.close(); } //榨取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>
再就是榨取网页另存了:
<!--榨取网页另存为: --> <noscript> <iframe src="/*"></iframe> </noscript>
尚有其它一种要领,除了榨取另存外,其余成果根基上搞定:
<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里.
根基上就是这么多,清算了一下。
提醒:可修改儿女码再运行! (编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|