Home > Tips and Tricks > 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:




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

Start Now »

SOLUTIONS FOR

GET DEMO
FREE TRIAL

FEATURES

LEARN & SUPPORT

COMPANY

Need a ride up?