[JavaScript] 마우스 오른쪽 버튼 사용시 경고 메세지 띄우기
페이지 정보
루루아빠
3,062
2015.10.31 20:36:38
짧은주소
-
https://yadolee.com/tip/325 주소복사
본문
<script type="text/javascript">
var message="마우스 우측 버튼은 사용할 수 없습니다."
function IE4(){
if(event.button==2){
alert(message)
return false}}
function NS4(e){
if(document.layers||document.getElementById&&!document.all){
if(e.which==2||e.which==3){
alert(message)
return false}}}
function disableselect(e){
return false}
function reEnable(){
return true}
document.onselectstart=new Function("return false")
if(window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable}
if(document.layers){
document.captureEvents(Event.MOUSEDOWN)
document.onmousedown=NS4}
else if(document.all&&!document.getElementById){
document.onmousedown=IE4}
document.oncontextmenu=new Function("alert(message);return false")
</script>
위 스크립트는 마우스 오른쪽 버튼 클릭시 경고 메세지를 띄우고 마우스 드래그를 통한 복사도 불가능하도록 한다.
다만 브라우저 상에서 JavaScript를 무력화시키면 작동치 않는다.
추천인
레벨 101
경험치 1,519,440
Progress Bar 14.66%
- 가입일 : 2015-03-04 03:24:54
- 서명 : KNOW YOUR LIMITS
BUT NEVER STOP TRYING TO EXCEED THEM !!
- 자기소개 : 루루의 자랑
루루아빠랍니다~~
최신댓글이 없습니다.


댓글
첫 번째 댓글을 남겨 주세요