|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi All,
Here is a javascript code for you to disable right-click on both Internet Explorer & Mozilla Firefox. Hope this code can help you all with your coding problems. Best Regards to All. ![]() Code:
var message="";
function clickIE()
{if (document.all)
{(message);return false;}}
function clickNS(e) {
if
(document.layers||(document.getElementById&&!document.all))
{
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document. onmousedown=clickNS;}
else
{document.onmouseup=clickNS;document.oncontextmenu =clickIE;}
document.oncontextmenu=new Function("return false")
|
|
#2
|
|||
|
|||
|
Thanks.
This was a snap and worked perfecty. I don't disable right-click as a rule, but I am developing a site that should not allow image snatching.
This will eliminate the casual user's ability to do that. |
|
#3
|
|||
|
|||
|
Hello,
Your script sounds like just what I need, I have a blog web site and I pasted the above script above the body as an HTML and when I viewd mt web site it appeared as text, PLEASE HELP! (mmatakeover@yahoo.ca) Thanks |
|
#4
|
||||
|
||||
|
script as text
Hi abernet1, welcome to the forums,
IMHO "disable right-click" is a waste of time, but anyway, did you put the code inside script tags?
__________________
WP plugins - Error Reporting, Clean Options http://www.mittineague.com/dev/er.php http://www.mittineague.com/dev/co.php |
|
#5
|
|||
|
|||
|
Stupid idea
Why you want to block users from right-click? Maybe you would like to disable mouse and keyboard support as well?
I'm using gestures under right-click. I'm using right-click menu for navigation. When I find a page that forbids right-click I add it to blocked sites. Some sites I really want to use - then I am fighting with scripts like that - by blocking the ability to block the right-click. Does it add any security? I can easily copy any content from such webs. Install chrome or firefox or maxthon and then drag'n'drop the picture - works perfectly. You can use browsers cache to get the picture. You can check the web's source to find the URL of the picture. You can use automatic-download-addons for browsers. There are more ways of copying the images. Again: Why do you want to make the user crippled? If you are reading this and going to use such script - knock yourself in your head and think again if that is what you want to do. If you really do then use huge flash animation instead of web content and make it full screen. And add a horn sound. Maybe a virus as well.... Yes - that is something that some web developers would love to do - or at least it looks so. Sorry for excessive criticism but the criticism is well earned in that case. |
|
#6
|
|||
|
|||
|
thank you very much for the javascript... i was badly in search of this ocde which works on both firefox and IE.... thanx once again
|
|
#7
|
|||
|
|||
|
i agree wid ur point adderek, there are many toolz and techniques that we can use to capture the image... but some websites basically official sites have to disable rightclick to some pages to meet the basic company requirements, so such codes will be very helpful for the webdesigners in order to fulfill the organisations requirement.....
|
|
#8
|
||||
|
||||
|
Such developers should spend more time educating their superiors, as these techniques only give the pretense of security.
This thread has been necro'd enough, I'm locking it.
__________________
This is my code. Is it not nifty? "The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools." ---Douglas Adams Join the Itsacon fanclub! Zero Tolerance: Spammers banned so far: 443
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Javascript to disable right-click on Mozilla Firefox & Internet Explorer |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|