// ==/UserScript==
(function() {
bad = {};
})();
可以禁用:
<html>
<body>
<a onclick="bad();">Click</a>
<script>
bad = function() {alert("bad");}
</script>
</body>
</html>
不能禁用:
<html>
<body>
<script>
bad = function() {alert("bad");}
bad();
</script>
</body>
</html>
请问第二种情况如何屏蔽之
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这样你的函数就不能被重新赋值了。但是当赋值时,会产生一个错误。
或者试试使用
Proxy
。