I would like to disable view source shortcut key for IE using JavaScript.
To disable Ctrl + C, I am using the following function:
function disableCopy() {
// current pressed key
var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();
if (event.ctrlKey && (pressedKey == "c")) {
// disable key press porcessing
event.returnValue = false;
}
}
Can any one suggest how to disable Alt + V + C combination?
每个浏览器都有其内置的功能来查看源代码或网页。我们可以做一件事。这就是禁用页面中的右键单击。
要禁用右键单击,请使用以下代码:
<SCRIPT TYPE="text/javascript">
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</SCRIPT>
记住一件事。我们可以使用 firebug 或其他一些第三方工具查看此源代码。所以我们不能 100% 做到这一点。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)