Disable Right Click on Images
This article will show you how to disable Right Click in your survey.
See the following articles if you have not already:
Overview
You may want the ability to Disable Right Click on Images so a respondent does not have the ability to save the image. There are 2 ways to do this:
- Disable Right Click on an Entire Survey
- Disable Right Click on a Specific Item
Disable Right Click - Entire Survey
- Go to the Default Text Card
- Click on 'Survey Settings' in on the left
- Click on 'Default Text'
- Click on the edit icon tied to the 'Survey Header'
- Click on the source icon (</>)
- 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>
- Click on the source icon (</>) to close the code view
- Once you are out of the code view, click 'SAVE'
- You can now close the 'Default Text' Card
Disable Right Click - On a Specific Item
- Go to the Static Element that contains the image
- Click on the Editor icon
- Click on the source icon (</>)
- Add the following code under the image 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>
- Click on the source icon (</>) to close the code view
- Once you are out of the code view, click 'SAVE'
- You can now close the Card