Advanced detection and prevention of DevTools usage and userscript injection for web applications.
npm install @evelocore/anti-devtoolsAdvanced detection and prevention of DevTools usage for web applications.
Supports Vanilla JS, React, and Vue.
``bash`
npm install @evelocore/anti-devtoolsor
yarn add @evelocore/anti-devtoolsor
pnpm add @evelocore/anti-devtools
`html`
`javascript
import { AntiDevtools } from '@evelocore/anti-devtools';
const anti = new AntiDevtools({
ondevtoolopen: () => {
console.log('DevTools opened!');
// Redirect or clear content
window.location.href = "about:blank";
},
ondevtoolclose: () => {
console.log('DevTools closed');
},
interval: 500 // check interval in ms
});
// To stop detection
// anti.destroy();
`
Option 1: Using the Hook
`tsx
import { useAntiDevtools } from '@evelocore/anti-devtools/react';
function App() {
useAntiDevtools({
ondevtoolopen: () => {
alert('DevTools detected!');
window.location.href = "about:blank";
},
ondevtoolclose: () => {
console.log('DevTools closed');
},
interval: 500 // check interval in ms
})
return (
Option 2: Using the Component
`tsx
import { AntiDevTools } from '@evelocore/anti-devtools/react';function App() {
return (
<>
ondevtoolopen={() => {
alert('DevTools detected!');
window.location.href = "about:blank";
}}
ondevtoolclose={() => {
console.log('DevTools closed');
}}
interval={500} // check interval in ms
/>
Protected App
>
);
}
`$3
`vue
Protected App
`Configuration
| Option | Type | Default | Description |
|---|---|---|---|
|
ondevtoolopen | () => void | window.location.href = "about:blank" | Callback when DevTools is detected opening. |
| ondevtoolclose | () => void | undefined | Callback when DevTools is detected closing. |
| interval | number | 500 | Detection check interval in milliseconds. |
| clearIntervalWhenDevOpenTrigger | boolean | false` | Stop checking after first detection. |ISC