0

I want to prevent my design codes so that I want to disable view source and inspect element options for my Wordpress Site. How can I do that? Is there any plugin or code? Please Help.

Thanks in Advance.

Ajit Singh
  • 15
  • 4
  • 13
  • You can disable right click.. – GYaN Nov 28 '17 at 11:49
  • Possible duplicate of [How to disable View source and inspect element](https://stackoverflow.com/questions/44310801/how-to-disable-view-source-and-inspect-element) – LuFFy Nov 28 '17 at 12:02
  • 1
    Possible duplicate of [How to disable browser developer tools?](https://stackoverflow.com/questions/7559409/how-to-disable-browser-developer-tools) – Wing Nov 28 '17 at 12:05

2 Answers2

0

Short answer: no, it's impossible to achieve. Why? Well, you have to understand what is happening when somebody visits your webpage: browser requests a document, and the SERVEr servs it: everything that you want the user to see has to be downloaded to the browser. View-source is only a Chrome method, it would work just as fine if you were to load it and then view locally. There are exeptions to that, f.e. u can post PHP messages without any http markups but as soon as we are talking html it has to be public. If you are afraid of breaching the copy rights I would make any JS or CSS given by js scripts elements being moved to private sections of server storage and then requesting their return values, stored in public files via server-side scripts, but frankly that seems to be even more problematic, not to mention enormously innefficent.

0
function disable_right_click() {
 ?>
<script>
jQuery(document).ready(function(){
jQuery(document).bind("contextmenu",function(e){
    return false;
});

});

</script>

<?php

}

add_action('wp_footer', 'disable_right_click');

past this code to functions.php of your wordpress theme/site....

Emon_Rana
  • 9
  • 5
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 07 '21 at 12:31