Skip to content

Commit

Permalink
屏蔽F12按键,并添加跳转机制
Browse files Browse the repository at this point in the history
  • Loading branch information
Paper-Dragon committed Nov 9, 2023
1 parent f741d9a commit 880acd5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ export default defineUserConfig({
/*禁用F12*/
document.onkeydown = function(){
if(window.event.keyCode==123) {
alert('大佬,别扒了!不妨加个友链?\\n执意要做?再按下F12可调出控制台');
var x;
var r=confirm('大佬,别扒了!不妨加个友链?\\n点击确认键跳转到友链!\\n\\n执意要做?亦或是再按下F12可调出控制台\\n');
if (r==true){
//x="你按下的是\\"确定\\"按钮。";
window.location.replace("/友链/友链.html");
}
else{
x="你按下的是\\"取消\\"按钮。";
}
// document.write(x)
event.preventDefault(); // 阻止默认事件行为
event.keyCode=0;
event.returnValue=false;
}
Expand Down

0 comments on commit 880acd5

Please sign in to comment.