The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Right click disabled for guests only

3 posters

Go down

Solved Right click disabled for guests only

Post by Mimóza April 26th 2016, 11:57 am

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:

Thanks in advance for any help! alien


Last edited by Mimóza on April 26th 2016, 12:58 pm; edited 1 time in total
Mimóza
Mimóza
Forumember

Female Posts : 678
Reputation : 278
Language : Hungarian, English

https://graphicballoon.forumotion.com/

Back to top Go down

Solved Re: Right click disabled for guests only

Post by Ange Tuteur April 26th 2016, 12:40 pm

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.
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.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Right click disabled for guests only

Post by Mimóza April 26th 2016, 12:57 pm

Hello Ange,
Thanks sooo much for the code! Works great, as always! Very Happy 
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. Right click disabled for guests only 1f614 
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. Right click disabled for guests only 1f609 

Thank a lot for your input and concerns, I really appreciate it! 
Solved.
Mimóza
Mimóza
Forumember

Female Posts : 678
Reputation : 278
Language : Hungarian, English

https://graphicballoon.forumotion.com/

Back to top Go down

Solved Re: Right click disabled for guests only

Post by Ange Tuteur April 26th 2016, 1:09 pm

Anytime Doff

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. Wink
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Right click disabled for guests only

Post by SLGray April 26th 2016, 9:27 pm

Topic solved and archived


Right click disabled for guests only Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51555
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum