Topic: oncontextmenu placement in a theme

Bwebs free asked 6 years ago

I am using the corporate theme and have two questions.  1. What is the accepted way of disabling right-click? 2. Where is the best place to input the script. I've seen code on the web, but not sure where to place it (in the body or as a separate JS under the js folder.) I've seen oncontextmenu scripts on the web, but not sure which one may be best or the correct place to input it. (I realize most can get around this trick, but I think it helps a well as disabling hotlinking). I am not a developer...practicing/learning a the moment. Thanks.

Jakub Strebeyko staff answered 6 years ago

Hi there Bwebs, There are several ways to do it, but disabling right click in general is rarely justifiable among the web-developer community. If you feel you need it anyway, I'm assuming you probably really need it and so it desired to have it wherever it gets loaded faster. In practice, to choice you have is either including it under the <script> tags at the bottom of html <body>, or throwing it in even earlier, at the beginning of the file, please be noted - when browser encounters the tag, it stops parsing the HTML. In the end doing so would suggest that blocking the right click is more important than the page's content itself. As you are learning, please take a moment to appreciate resources such as StackOverflow, where seemingly all basic questions regarding web development have been already asked and general-purpose cases have been covered. With Best Regards, Kuba

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: Other
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No