// ==/UserScript==
(function() {
bad = {};
})();
Can be disabled:
<html>
<body>
<a onclick="bad();">Click</a>
<script>
bad = function() {alert("bad");}
</script>
</body>
</html>
Cannot be disabled:
<html>
<body>
<script>
bad = function() {alert("bad");}
bad();
</script>
</body>
</html>
How to block the second situation
PHP中文网2017-07-05 10:59:02
const bad = {};
This way your function cannot be reassigned. But when assigning a value, an error occurs.
Or try using Proxy
.