How to hide form code from view code/inspect element browser?

前端 未结 13 2218
深忆病人
深忆病人 2020-11-29 01:15

I want to hide form code from view code/inspect element browser , how can i do that ?

This is my code, please see below:

13条回答
  •  [愿得一人]
    2020-11-29 02:18

    There is a smart way to disable inspect element in your website. Just add the following snippet inside script tag :

    $(document).bind("contextmenu",function(e) {
     e.preventDefault();
    });
    

    Please check out this blog

    The function key F12 which directly take inspect element from browser, we can also disable it, by using the following code:

    $(document).keydown(function(e){
        if(e.which === 123){
           return false;
        }
    });
    

提交回复
热议问题