Script: Disable Right Click Context Menu
This article will help you add code to a specific screen or an entire survey to disable the right click context menu
Background
You may want to stop the ability for a respondent to access the Context Menu when you right click on a screen.
- Examples of why you would need to do this are:
- You have new concept images in your survey that are not for public release
- Depending on the browser this may also have access to the print function
Disable Right Click Context Menu (Entire Survey)
- Access the Survey Authoring Tool (SAT)
- Access the 'DEFAULT TEXT'
- See article: Default Text: Accessing Default Text Menu
- Click on the HTML Editor icon tied to the 'SURVEY HEADER'
- Access the Source Code Editor (</>)
- See Article: Source Code Editor
- While in the Source Code Editor, add the following code
<script type="text/javascript"> /*DISABLE RIGHT CLICK FOR THIS PAGE*/ if (typeof cmSurvey !== 'undefined') { if (typeof cmSurvey.plugins === 'undefined') { cmSurvey.plugins = {}; } (function($) { cmSurvey.plugins.stopRightClick = function(questionNames, config) { $("body").attr("oncontextmenu", "return false"); }; })(jQuery); } cmSurvey.onPageLoad(function() { cmSurvey.plugins.stopRightClick([], {}); }); </script>
- Don't forget to test
Disable the Menu on Specific Screens
You can also set this up for just one specific screen if needed
- Open one of the question cards for the specific screen you want this to happen on
- Access the HTML Editor for any of the fields available. The best ones to use would be the question text or the instruction text (if applicable).
- Next follow steps 4 through 6 above