Stop Scammers Changing Webpages From Browser Devtool – DOM Guard

Category: Javascript , Recommended | April 1, 2021
Views Total:133 views
Official Page:Go to website
Last Update:April 1, 2021


Stop Scammers Changing Webpages From Browser Devtool – DOM Guard


DOM Guard is a JavaScript library created to stop the browser’s devtool from modifying elements to prevent fraudsters from scamming by forging your web page.

It uses MutationObserver API to watch for changes being made to the DOM tree and automatically restores the original value after a period of time.

See Also:

How to use it:

1. Install and import the DOM Guard as an ES module.

$ npm i dom-guard
import DOMGuard from 'dom-guard'

2. Or download the library and insert the dom-guard.umd.js into the document.

<script src="dist/dom-guard.umd.js"></script>

3. Create a new instance of the DOM Guard and specify the element to be protected.

<h1 id="protected">You can not change this element</h1>
const guard = new DOMGuard({
      selector: '#protected',
      heartbeat: 1000 // check every 1 second

4. Initialize the DOM Guard and done.


5. Disable the DOM Guard.


You Might Be Interested In:

Leave a Reply