获取控制台历史记
问题描述:
我想知道javascript中是否有办法检索控制台历史记录。
I'd like to know if there is a way in javascript to retrieve console history.
控制台历史记录的含义是dev工具控制台中显示的内容。
例如,我想在html页面中打印我的开发工具中显示的所有错误,警告,信息和日志,而不打开它们。
What I mean by console history is what appears in the dev tools console. For instance, I'd like to print in a html page all errors, warnings, info and log that are displayed in my dev tools without opening them.
如果我不清楚,请告诉我。
Let me know if I'm not clear.
答
Chrome扩展程序有一个API, experimental.devtools.console :
Chrome extensions had an API for that, experimental.devtools.console:
chrome.experimental.devtools.console.getMessages(function(messages) { })
此API已被删除。