Disable Right Click
3 posters
Page 1 of 1
Disable Right Click
How can I disable Right Click only for images?
Last edited by 1NtRuD3R on January 7th 2013, 6:43 pm; edited 1 time in total
Re: Disable Right Click
Hi,
Put this in a widget.
Put this in a widget.
- Code:
<script language="JavaScript1.2">
/*
Disable right click script II (on images)- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.com
*/
var clickmessage="Images and WCF content are copyright of their respective owners. Violators may be prosecuted."
function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}
function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()
</script>
Empire_1- Active Poster
- Posts : 1391
Reputation : 125
Language : English, Spanish, Mandarin, C++
Location : Summoner's Rift
Re: Disable Right Click
Yes I believe.
Sanket- ForumGuru
- Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai
Re: Disable Right Click
Add this code in Modules> Javascript Code Management
Enable Javascript code management : Yes
Create a new javascript
placement: In all the pages.
Reference: http://www.bloggersentral.com/2012/05/disable-right-click-on-images.html
Enable Javascript code management : Yes
Create a new javascript
placement: In all the pages.
- Code:
function nocontext(e) {
var clickedTag = (e==null) ? event.srcElement.tagName : e.target.tagName;
if (clickedTag == "IMG") {
alert(alertMsg);
return false;
}
}
var alertMsg = "Image context menu is disabled";
document.oncontextmenu = nocontext;
Reference: http://www.bloggersentral.com/2012/05/disable-right-click-on-images.html
Sanket- ForumGuru
- Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai
Re: Disable Right Click
Topic Solved & Locked |
Sanket- ForumGuru
- Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai
Similar topics
» Disable Right Click
» Disable right click for images only
» Script To Disable The Right-Click
» little help in that code disable the right click
» How to disable right click save option?
» Disable right click for images only
» Script To Disable The Right-Click
» little help in that code disable the right click
» How to disable right click save option?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum