1
有没有办法清除错误控制台从userscripts GM_log消息在某些事件?清除GM_log从错误控制台
我不想手动清除。 On trigger of certain event, want to clear up the old log from the error console and show up the new log.
有没有办法清除错误控制台从userscripts GM_log消息在某些事件?清除GM_log从错误控制台
我不想手动清除。 On trigger of certain event, want to clear up the old log from the error console and show up the new log.
您无法清除the error console。如果可以的话,邪恶的网站也可以清除它,并抹去他们的不当行为记录。
反正你不应该再使用GM_Log()
。 Use Firebug和the excellent console logging functions it provides。您可以使用console.clear()
。
请注意,为避免与Firefox的新功能console
功能发生冲突,并确保输出显示在Firebug的控制台中,您可能需要以unsafeWindow
为前缀调用。
所以,你的脚本可以做这样的事情:
unsafeWindow.console.clear();
unsafeWindow.console.time ('ScriptRun');
unsafeWindow.console.log ("Script start.");
unsafeWindow.console.timeEnd ('ScriptRun');
看起来像这样在Firebug控制台其中:
- 与上述所有冗余代码删除。 (尽管clear()
调用仍会出现,网页所做的任何操作仍会显示。)