Disallow console.clear

Self explanatory. As of Firefox 117, you can just use the `Enable persistent logs` feature in devtools, it now disables console.clear().

< 脚本Disallow console.clear的反馈

提问/评论

§
发表于:2025-01-26
// ==UserScript==
// @name          Prevent console.clear
// @description   Replaces console.clear with a function that does nothing
// @version       1
// @match         *://*/*
// @grant         unsafeWindow
// @run-at        document-start
// ==/UserScript==

(function() {
  unsafeWindow.console.clear = () => {};
}());
§
发表于:2025-01-27

Nevermind, this code also doesn't work at the place I need

brian6932作者
§
发表于:2025-04-16

I'm not sure what the issue was here, but I could make this a little stricter.

发表回复

登录(不可用)以发表回复。

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址