Skip to content

Instantly share code, notes, and snippets.

@bhumit070
Created May 3, 2023 04:09
Show Gist options
  • Save bhumit070/a12f5adf5f05b80e69ad942779cceee6 to your computer and use it in GitHub Desktop.
Save bhumit070/a12f5adf5f05b80e69ad942779cceee6 to your computer and use it in GitHub Desktop.
STOP_BROWSER_ON_DEBUGGER_IF_DEVTOOLS_IS_OPENED
-- HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<script type="text/javascript" src="debug.js"></script>
<script type="text/javascript">
var tryCount = 0;
var minimalUserResponseInMiliseconds = 200;
function check() {
console.clear();
before = new Date().getTime();
anonymous();after = new Date().getTime();
if (after - before > minimalUserResponseInMiliseconds) {
document.write(" Dont open Developer Tools. ");
self.location.replace(window.location.protocol + window.location.href.substring(window.location.protocol.length));
} else {
before = null;
after = null;
delete before;
delete after;
}
setTimeout(check, 100);
}
check();
window.onload = function() {
document.addEventListener("contextmenu", function(e) {
e.preventDefault();
}, false);
document.addEventListener("keydown", function(e) {
if (e.ctrlKey && e.shiftKey && e.keyCode == 73) {
disabledEvent(e);
}
if (e.ctrlKey && e.shiftKey && e.keyCode == 74) {
disabledEvent(e);
}
if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
disabledEvent(e);
}
if (e.ctrlKey && e.keyCode == 85) {
disabledEvent(e);
}
if (event.keyCode == 123) {
disabledEvent(e);
}
}, false);
function disabledEvent(e) {
if (e.stopPropagation) {
e.stopPropagation();
} else if (window.event) {
window.event.cancelBubble = true;
}
e.preventDefault();
return false;
}
}
;
</script>
</body>
</html>
-- debug.js
(function anonymous(
) {
debugger
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment