Safari 开发者工具:如何在导航时保留控制台日志?
使用 Safari Web Inspector 读取 JavaScript 时控制台输出,日志在导航时重置,即从页面 index.html 到 mail.html 会清除控制台输出.在 Chrome 开发者工具中,我可以通过右键单击控制台空间来轻松保存日志,然后选择在导航时保留日志.使用此选项,控制台日志输出将保持不变,直到我手动清除输出,从而简化了刷新或重定向到另一个页面的 JavaScript 调试过程.
When using Safari Web Inspector to read the JavaScript console output, the log is reset upon navigation i.e. going from page index.html to mail.html clears the console output. In the Chrome Developer Tools, I can easily preserve the log by right clicking on the console space and selecting Preserve Log Upon Navigation. With this option, console log output remains intact until I manually clear the output simplifying the process of debugging JavaScript that refreshes or redirects to another page.
Safari Web Inspector 中是否有类似的功能?
Is there a similar feature in Safari Web Inspector?
推荐答案
我不知道这是什么时候添加的,但它存在于 El Capitan 上的 Safari(Safari 9.0)中.它与 Chrome 中的工作方式相同(在控制台窗口中单击鼠标右键并选择保持登录导航").
I don't know when this was added, but it is present in Safari on El Capitan (Safari 9.0). It works the same as in Chrome (right click in the console window and select "Keep Log on Navigation").
更新:根据 Daniel Compton 的回答,现在在 Safari 11+ 中设置图标为控制台:页面导航时清除".
Update: As per Daniel Compton's answer, in Safari 11+ this is now under the settings icon as 'Console: Clear when page navigates'.
更新:设置现在恢复为保留日志".在 Safari 14+ 的开发者控制台中的网络"选项卡中
Update: The setting is now back to "Preserve log" in the Network tab in the developer console in Safari 14+
相关文章