Element Inspection Anti Debug Script

Anti Debug Element Inspection JavaScript code works to disable debugger/debugger in browser.
Anti Debug Element Inspection JavaScript code works to disable debugger/debugger in browser.

Blogger Template - Anti Debug Element Inspection JavaScript code works to disable debugger/debugger in browser. This means that this script will turn off or disable the element inspection function (inspect element) in the browser so that others can not debug or edit web components such as editing javascript, html, css and others in the browser.

Inspect Element (inspection element) is a feature contained in a browser that serves to debug a web or edit a web page. Debugging is usually used for:

  1. View and edit html,
  2. Viewing and editing css,
  3. Seeing how the request header works,
  4. View external link sources of web components.
  5. See how script code works and edit script code, 
  6. Copy paste web components (html, css, javascript, images, etc.),
  7. and others.

If we look at the Debug Inspection Element function above, then the Debug Inspection Element function has advantages and disadvantages. Advantages can certainly help us to edit or review the results of a code that we have written. If we are a developer or web developer of course this becomes a problem because if we make a product such as website template, blogger template and some website functions that use script code then the code we write can be copied or even copied by the code plagiarist.

The advantage of this Debug Inspection Element feature is a weakness that is used by the code plagiarist to take some or all of our website code that we have created with difficulty. Therefore, here I will share an Anti Debug Element Inspection Script that serves to disable debug/debugger in the browser.

This script is very useful if you are a program code writer. I say useful because this script will protect our script code from code plagiarists so they can't edit or see how our script works. Although the Element Inspection Anti Debug Script can't completely secure our code, at least this Element Inspection Anti Debug Script can be a little helpful.

Script Anti Debug Element Inspection

Here is the Element Inspection Anti Debug Script that you can use. I call this script the "Anti Debug Protection Script".

var _0xa51c91=function(){var n=!0;return function(t,r){var u=n?function(){if(r){var n=r.apply(t,arguments);return r=null,n}}:function(){};return n=!1,u}}();function _0x322468(n){function t(n){if("string"==typeof n)return function(n){}.constructor("while (true) {}").apply("counter");1!==(""+n/n).length||n%20==0?function(){return!0}.constructor("debugger").call("action"):function(){return!1}.constructor("debugger").apply("stateObject"),t(++n)}try{if(n)return t;t(0)}catch(n){}}!function(){_0xa51c91(this,function(){var n=new RegExp("function *\\( *\\)"),t=new RegExp("\\+\\+ *(?:_0x(?:[a-f0-9]){4,6}|(?:\\b|\\d)[a-z0-9]{1,4}(?:\\b|\\d))","i"),r=_0x322468("init");n.test(r+"chain")&&t.test(r+"input")?_0x322468():r("0")})()}(),nodebug="";

The script above can be located in the <head> make sure here </head> section or in the <body> make sure here </body> section. You can also paste this script code in the article section of the page, so that this script will run on certain pages only.

To improve the script above, I have added an interval that will run the script repeatedly so that if someone plagiarizes the code to do debugging then the console inspect element will crash or stuck. This will make the browser inaccessible, requiring the plagiarist to refresh the web page. When the plagiarist refreshes the page and it turns out that the inspect element is still running, then the crash or stuck event will be repeated until the plagiarist closes the inspect element.

Here is the Element Inspection Anti Debug Script that I have perfected by adding intervals. I call this script the "Anti Debug Protection Interval Script". Here is the script.

var _0x28406a=function(){var n=!0;return function(t,e){var r=n?function(){if(e){var n=e.apply(t,arguments);return e=null,n}}:function(){};return n=!1,r}}();function _0x4181ae(n){function t(n){if("string"==typeof n)return function(n){}.constructor("while (true) {}").apply("counter");1!==(""+n/n).length||n%20==0?function(){return!0}.constructor("debugger").call("action"):function(){return!1}.constructor("debugger").apply("stateObject"),t(++n)}try{if(n)return t;t(0)}catch(n){}}!function(){_0x28406a(this,function(){var n=new RegExp("function *\\( *\\)"),t=new RegExp("\\+\\+ *(?:_0x(?:[a-f0-9]){4,6}|(?:\\b|\\d)[a-z0-9]{1,4}(?:\\b|\\d))","i"),e=_0x4181ae("init");n.test(e+"chain")&&t.test(e+"input")?_0x4181ae():e("0")})()}(),nodebugger="",setInterval(function(){_0x4181ae()},4e3);

As usual, you can place the script above in the <head> make sure here </head> section or in the <body> make sure here </body> section. You can also paste this script code in the article section of the page, so that this script will run on certain pages only.

Maybe that's all I can share for this time, if there are obstacles in the use of the Element Inspection Anti Debug Script above. You can comment below. Thanks for visiting.