butlar

Detect Devtools

Nov 23rd, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>Document</title>
  8. </head>
  9. <body>
  10.  
  11. <div id="app">
  12. <h3>
  13. Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatum,
  14. dicta iure. Explicabo, alias fugit? Quia quae molestiae, quam obcaecati
  15. molestias fugit commodi maxime porro quasi harum, eos unde placeat modi?
  16. Lorem ipsum dolor sit amet consectetur adipisicing elit. Numquam,
  17. aperiam molestiae ad nulla asperiores neque odio maxime itaque,
  18. expedita, quam repellat tenetur! Iusto impedit animi maxime voluptatum
  19. vitae eligendi unde! Lorem ipsum dolor sit amet consectetur adipisicing
  20. elit. Corporis nobis facilis et? Error eum praesentium laboriosam nemo
  21. ullam incidunt tempore neque, dignissimos dolor consequatur aperiam
  22. dicta assumenda totam libero vero?
  23. </h3>
  24. </div>
  25.  
  26. <script>
  27.  
  28. setInterval(po)
  29. var devtoolOpened = false;
  30. var result = null;
  31.  
  32. function check(devtoolOpened) {
  33.  
  34. if( devtoolOpened == true ){
  35. var t = clearInterval(po)
  36. if(t){
  37. changeSize()
  38. alert(devtoolOpened)
  39. }
  40. }else{
  41. alert(devtoolOpened)
  42. // clearInterval(po)
  43. }
  44.  
  45. }
  46.  
  47. var devtools = function () {};
  48.  
  49.  
  50. devtools.toString = function () {
  51.  
  52. document.body.innerHTML = '<h2 style="width:100%;text-align:center;"><strong>Sorry</strong>, but you have opened Developer Tools and you can\'t continue using this app.</h2>';
  53. devtoolOpened = true;
  54. check(devtoolOpened);
  55.  
  56. return '-'
  57. };
  58.  
  59. window.addEventListener('resize', changeSize);
  60. function changeSize(){
  61. clearInterval(po)
  62. console.clear()
  63. location.reload();
  64. }
  65.  
  66. var po = setInterval(() => {
  67. console.profile(devtools);
  68. console.profileEnd(devtools);
  69. }, 500);
  70.  
  71.  
  72. </script>
  73. </body>
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment