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.

發表回覆

登入以回復