asp.net mvc 4 - How to disable Inspect Element and f12 click? -


i have pdf open in new window through iframe, when disabled f12 , inspect element not working on pdf, it's working outside of pdf.

  <body>       <div id="divpdfview" style="margin: auto;text-align: center;">       </div>       <div style="display:none;" id="divdocument">     @if (model.myaccountlist.count > 0)     {         foreach (var items in model.myaccountlist)         {             <a href="#" onclick="mypdf(this)" id="@items.pdfname">              <div class="sm-video">                ///there have work              </div>          }     }  </body>     <script>     function mypdf(e) {         var filen = e.id;         debugger;         window.open('@url.action("pdfshow", "myaccount")?pdfname=' + filen);                } </script>         ///here show pdf view pdfshow              <body>               <div>                 @html.raw(tempdata["embed"])               </div>             </body> 

this javascript code use disable f12 , inspect element work outside of pdf.

        <script>          $(document).ready(function () {           debugger            document.onmousedown = disableclick;             status = "right click disabled";               function disableclick(event) {                if (event.button == 2) {                 alert(status);                return false;            }        }     }); </script>   <script type='text/javascript'>      $(document).keydown(function (event) {         debugger         if (event.keycode == 123) {             return false;         }         else if (event.ctrlkey && event.shiftkey && event.keycode == 73) {             return false;  //prevent ctrl+shift+i         }     }); </script> 

this controller code pdf created using iframe

 public actionresult pdfshow(string pdfname = null)     {         string pdffile ="<iframe src='/content/tutorialimage/tutorialpdf/" +                           pdfname + "#toolbar=0' width='800px' height='600px'                           id='myframe' oncontextmenu='return false;' >                         </iframe>";          tempdata["embed"] = pdffile;         return view(tempdata["embed"]);     } 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -