显示在页面内的div控制台错误和警告 [英] Showing console errors and alerts in a div inside the page
本文介绍了显示在页面内的div控制台错误和警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我建立了我的web应用程序调试工具,我需要显示一个div控制台的错误。我知道我可以用我自己做的控制台喜欢对象,并使用它,但以备将来使用,我需要把所有的控制台错误窗口。其实我要赶控制台的事件。
I'm building a debugging tool for my web app and I need to show console errors in a div. I know I can use my own made console like object and use it, but for future use I need to send all console errors to window. Actually I want to catch console events.
推荐答案
要保持控制台工作:
if (typeof console != "undefined")
if (typeof console.log != 'undefined')
console.olog = console.log;
else
console.olog = function() {};
console.log = function(message) {
console.olog(message);
$('#debugDiv').append('<p>' + message + '</p>');
};
console.error = console.debug = console.info = console.log
这篇关于显示在页面内的div控制台错误和警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文