Right click disabled for guests only
3 posters
Page 1 of 1
Right click disabled for guests only
Technical Details
Forum version : #PunBB
Position : Founder
Concerned browser(s) : Other
Screenshot of problem :
Who the problem concerns : All members
When the problem appeared :
Forum link : http://www.graphicballoon.com/
Description of problem
Hello everyone,I have added a script to my site, which disables the right click option for everyone. However, it is rather bothersome for the members, so I'd like to ask if it was possible to add a code that disables the right click option only for guests and members are free to continue using it.
- The code I'm using now:
- Code:
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="Ask before you take something. :)";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(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=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
Thanks in advance for any help!
Last edited by Mimóza on April 26th 2016, 12:58 pm; edited 1 time in total
Re: Right click disabled for guests only
To be honest, disabling right click / context menu achieves nothing but annoying your users. You can just disable JavaScript or open the devtools and take the code, image, etc.. From one developer to another ; You cannot protect your source code, images, etc.. on the internet. If it's out there and they want it, they'll find a way to get it.
That being said.. if you're really hellbent on barring people ( well, guests ) from their context menus, the following script should work just fine.
Personally, I'd recommend making the topics or forum unviewable to guests if you really want to stop them from looking at / taking content, as the prior solution is a controversial one and really only achieves a false sense of security ; they'll still be able to take your content if they really want it.
That being said.. if you're really hellbent on barring people ( well, guests ) from their context menus, the following script should work just fine.
- Code:
(function() {
window.fa_alert_msg = 'Ask before you take something. :)';
document.oncontextmenu = function() {
alert(fa_alert_msg);
return false;
};
$(function() {
// remove event handler for members
if (_userdata.session_logged_in) {
document.oncontextmenu = null;
}
});
}());
Personally, I'd recommend making the topics or forum unviewable to guests if you really want to stop them from looking at / taking content, as the prior solution is a controversial one and really only achieves a false sense of security ; they'll still be able to take your content if they really want it.
Re: Right click disabled for guests only
Hello Ange,
Thanks sooo much for the code! Works great, as always!
As for the advice, yeah, I am aware of the negative side effects this can bring, however, I think making the forum unviewable is a risky choice as well for a design forum. For example, the Graphic Balloon's strongest point for now is the section where graphics are shared, if we were to hide it, I guess even less people would be motivated to join.
I'm also aware of that there are possible ways of getting around this script, but even if only a small amount of people will be stopped from taking the images without a word, I'd like it to be added.
Thank a lot for your input and concerns, I really appreciate it!
Solved.
Re: Right click disabled for guests only
Anytime
It'll most likely stop some, but I figured I'd let you ( and anyone else ) know that it's not a sure-fire way.
Anyway, have a good day.
It'll most likely stop some, but I figured I'd let you ( and anyone else ) know that it's not a sure-fire way.
Anyway, have a good day.
Re: Right click disabled for guests only
Topic solved and archived
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Similar topics
» So I disabled guests from viewing Members List.....
» HTML Disabled
» Guests can't click on links
» Enable Guests to click user profile links
» Closed to guests but guests still viewing?
» HTML Disabled
» Guests can't click on links
» Enable Guests to click user profile links
» Closed to guests but guests still viewing?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum