1. Help
  2. Customization
  3. How to disable right-click on galleries

How to disable right-click on galleries

You can disable right-click on galleries by following the steps below:

1.   Go to Galleries page.

Click on “Embed Gallery” under the gallery you would like to embed.

2.   Choose the method you want to embed for the gallery to your website and click ‘Copy Embed Code‘ and paste it in your blog or website.

3.   In order to disable right-click on these embedded galleries paste the following code on the same page with Cincopa gallery.

NOTE: The code can be pasted anywhere on the page.

<script type="text/javascript"> window.onload = function(){ document.body.setAttribute('oncontextmenu', 'return false'); var ze_galleries = document.querySelectorAll('.cp_reset_style'); for(var i = 0; i < ze_galleries.length; i++){ try{ var childrenIframe = ze_galleries[i].children[0]; var doc = childrenIframe.contentDocument; if (doc == undefined || doc == null) { doc = childrenIframe.contentWindow.document; } doc.body.setAttribute('oncontextmenu', 'return false'); }catch(ex){ console.log(ex); } } } </script>

You can also check support article How to secure galleries

Was this article helpful?