
25天前
让我先BB几句
写这篇文章是因为最近在小红书浏览字体时想保存图片,但是他设置了禁止保存,可以很大程度上禁止转载问题,不过我是何人?雕虫小技罢了。
起初右键失灵,应该是屏蔽了右键,图片点击显示仅供演示不可另存为,应该是赋予了img限制。寻思着看看F12咋样,没反应,接着Ctrl+Shift+I,没反应。Shift+F10调用右键呢?依旧没反应。哼哼哼,我说过,前端不存在仅供演示,所有的前端都是开源!正所谓道高一尺魔高一丈,工具栏调用试试呢?成功了,看来小红书老贼遗漏了屏蔽在工具栏调起开发者工具。说到这可能有人问了,如果他屏蔽了工具栏调用你怎么办?那有啥,办法总比困难多。Ctrl+P保存PDF不可以吗?扒站不可以吗......主要给大家介绍了关于利用Javascript如何禁止浏览器右键查看元素,或者通过按F12审查元素,触犯这两个条件会自动并关闭页面的相关资料,通过设置这个可以防止别人扒下自己的网页,需要的朋友可以参考借鉴,下面来一起看看吧。
一、屏蔽F12 审查元素
<script>
document.onkeydown = function () {
if (window.event && window.event.keyCode == 123) {
alert("F12被禁用");
event.keyCode = 0;
event.returnValue = false;
}
if (window.event && window.event.keyCode == 13) {
window.event.keyCode = 505;
}
if (window.event && window.event.keyCode == 8) {
alert(str + "\n请使用Del键进行字符的删除操作!");
window.event.returnValue = false;
}
}
</script>
二、屏蔽右键菜单
<script>
document.oncontextmenu = function (event) {
if (window.event) {
event = window.event;
}
try {
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
return false;
}
return true;
} catch (e) {
return false;
}
}
</script>
三、屏蔽粘贴
<script>
document.onpaste = function (event) {
if (window.event) {
event = window.event;
}
try {
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
return false;
}
return true;
} catch (e) {
return false;
}
}
</script>
四、屏蔽复制
<script>
document.oncopy = function (event) {
if (window.event) {
event = window.event;
}
try {
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
return false;
}
return true;
} catch (e) {
return false;
}
}
</script>
五、屏蔽剪切
<script>
document.oncut = function (event) {
if (window.event) {
event = window.event;
}
try {
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
return false;
}
return true;
} catch (e) {
return false;
}
}
</script>
六、屏蔽选中
<script>
document.onselectstart = function (event) {
if (window.event) {
event = window.event;
}
try {
var the = event.srcElement;
if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
return false;
}
return true;
} catch (e) {
return false;
}
}
</script>
emmm这个怎么说呢,只防君子,不防小人
那肯定的咯,如果真的要扒肯定是可以的