반응형
1. 아래의 소스코드를 <head> 태그 사이에 넣는다.
<head>
...
<script type="text/javascript">
// F12 버튼 방지
$(document).ready(function(){
$(document).bind('keydown',function(e){
if ( e.keyCode == 123 /* F12 */) {
e.preventDefault();
e.returnValue = false;
}
});
});
// 우측 클릭 방지
document.onmousedown=disableclick;
status="Right click is not available.";
function disableclick(event){
if (event.button==2) {
alert(status);
return false;
}
}
</script>
...
</head>
2. <body> 안에 아래의 태그를 입력한다.
- oncontextmenu='return false' - 우클릭방지
- onselectstart='return false' - 블럭선택방지
- ondragstart='return false' - 드래그방지
<body oncontextmenu='return false' onselectstart='return false' ondragstart='return false'>
P.S. 키보드 버튼 식별코드
출처: https://server-engineer.tistory.com/563?category=689599 [HelloWorld]
반응형
'JavaScript > ETC' 카테고리의 다른 글
[Javascript] axios로 rest api 호출시 cookie 값 전달 안되는문제 해결 (0) | 2024.04.09 |
---|---|
자바스크립트 고차 함수 (0) | 2024.04.09 |
자바스크립트로 웹 페이지를 긁어오는 두 가지 방법 (0) | 2019.09.10 |