Forum Moderators: open

Message Too Old, No Replies

Capturing XHTML and CSS errors with JavaScript from error console?

         

JAB Creations

5:22 pm on Feb 13, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I absolutely love error reporting as fixing broken code leads to much greater reliability so I've been wondering of late if there is a way for me to capture XHTML and CSS errors logged in browser consoles? If so I could save the relevant information and send it to my server to be analyzed at a later point. Where would I start?

For clarification I'm not talking about JavaScript error handling of JavaScript errors nor do I want to write to the console, I want to read from it.

- John

JavaScript error handling...
window.onerror=function(msg,url,line) {alert('A JavaScript error has occurred...\n\nError: '+msg+'\n\nFile: '+url+'\n\nLine: '+line);}

rainborick

7:25 pm on Feb 13, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



JavaScript doesn't have any native ability to detect or capture X/HTML and CSS errors that I know of, and I don't think you can communicate with any debugging tools that a user might have available in his browser due to security blocks.

On the whole, I think such errors are best dealt with while you're composing your pages, anyway. These are not the sorts of issues that tend to arise "periodically" depending on user actions. It's generally valid or invalid from the start.