Add to Google

How Do You Disable Right Clicking?

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Java, Java Servlets, Java Script, & JSP

How Do You Disable Right Clicking?

ZeroHawk
How do you disable right clicking? I have no javascript knowledge, so can someone give me the full code? Thanks.

Reply

rvalkass
This is the code for disabling right click:

CODE

<script language=JavaScript>
<!--
var message="Function Disabled!";
function rclickIE(){
if (event.button==2){
alert(message);
return false;
}
}
function rclickNS(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=rclickNS;
}
else if (document.all&&!document.getElementById){
document.onmousedown=rclickIE;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>


Change the line that says var message="Function Disabled"; to contain your message.
e.g. var message="You are not stealing my stuff";

Hope that helps.

 

 

 


Reply

Becca
No java needed.. welli think not.

CODE
<body onclick="return false">
might stop peopel from right clicking. Simple

- no annoying popups.
- not rightclicking

Reply

Arigato
There is really no effective way to hide source code. Disabling right click is a very old method of an attempt to hide source code or protect images and alot of people now know to get around that these days. On apple computers this is completely useless because they have no right click button.

Reply

ZeroHawk
Let's put it this way: the stuff I'm concerned about wouldn't be worth a workaround.

Reply

Red Alert
Worth a work around? All you have to do is click the "View" menu, then click "Source". No code can stop someone from doing that. That could be considered even easier that right click >view source
.................................................. .................................................. .................................................. ..................................................
.................................................. .................................................. .................................................. ..................................................

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. java "disable clicking" - 790.92 hr back. (1)
  2. how do i protect images from right-click? - 2106.35 hr back. (1)
Similar Topics

Keywords : disable, clicking

  1. Help: Disable All Buttons Inside A Div Element
    How do you write a function to disable all buttons given a div id (8)
  2. Double Dropdown
    Disable the second until first is selected (2)
    Allright so heres the deal.. Im trying to make a 3 teir dropdown Sort, Order, User both will be
    populated by a database so dont worry about the content inside of them they will be the same stuff
    in both but in a diffrent order by using php (ajax i guess is what it is since its javascript with
    php lol) CODE $c=mysql_connect ("localhost", "database", "password") or die
    ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db
    ("database"); echo "     Sort by:          Name          Level          Email          C....
  3. Javascript Alert On When Clicking A Link
    (2)
    Basically, I want that a message box pops up when clicking on a specific link. The message box will
    ask "Are you sure you want to continue?" and then there are two buttons Yes or No / Ok or Cancel.
    Could someone give a code for it?....
  4. Is It Possible To Disable A Jbutton
    and make its icon still have colors? (0)
    I'm making minesweeper so I have this big matrix of JButtons. I want to have it so that when you
    click the button is disabled and the ImageIcon is changed to whatever it should be, but when you
    disable a button it becomes grayscale so the pictures are hard to see/don't look like what
    they're supposed to. Is there a way to disable the button and keep the images colorful, or does
    anyone have any other ideas? (I've thought about just removing the ActionListener but that
    might get confusing to have blank buttons that do nothing. Maybe only disabling it if t....

    1. Looking for disable, clicking






*SIMILAR VIDEOS*
Searching Video's for disable, clicking

*MORE FROM TRAP17.COM*
advertisement



How Do You Disable Right Clicking?



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE