Hello all! I have a javascript running on my site at http://www.kayoss.net that disables right clicking (viewing source, saving pictures, etc.) that works beautifully in IE...but not in Firefox. Does anyone know of a solution?

Recommended Answers

1st, the script calls for an argument to be passed in, it appears to be the Event object, yet your call doesn't pass anything in.

Also, the script definition should properly be inside the head section. Lastly, it's a bad idea, in my opinion, to attempt to alter or …

Jump to Post

Disabling right click is done using a single statement.

<body oncontextmenu="return false;">

This works for both the mouse and the keyboard in all modern browsers except Opera (which doesn't allow you to block right click).

Jump to Post

All 6 Replies

1st, the script calls for an argument to be passed in, it appears to be the Event object, yet your call doesn't pass anything in.

Also, the script definition should properly be inside the head section. Lastly, it's a bad idea, in my opinion, to attempt to alter or change the user model.

Disabling right click is done using a single statement.

<body oncontextmenu="return false;">

This works for both the mouse and the keyboard in all modern browsers except Opera (which doesn't allow you to block right click).

It is a known problem that that Javascript will behave different with various browsers. On of the way is to use javascript that is generally accepted by W3 standards. If some functions still do not work, try hiding the script from that browser to avoid any errors.

Thank you,
Ryan

Some JavaScript Functions Are not Working in FireFox Browser.
I want to Know what is the reason why it is not working ?

Some JavaScript Functions Are not Working in FireFox Browser.
I want to Know what is the reason why it is not working ?

One common reason is that the script is using a property which is not available in that browser.

For example: innerText vs. textContent.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.