The line # isn’t so useful when your page is dynamically generated. What I’d really like is the actual offending line.
Is there some way of doing this? Perhaps
document.getElementsByTagName('html')[0].innerHTML.Split('\n')[lineNumber-1];
// OR
document.body.innerHTML.Split('\n')[lineNumber-1];
However, when I tested it in Firefox 10, I got that the above were inaccurate unless the html and body tags were on the same line.
Thanks in advance.
For anyone who is curious, the answer for me was to make the number of lines above the first
headorbodyelement consistent across all pages.For me this magic # is three.
One should note though that if the error occurred in a js file, then I don’t know how to get the actual line client-side. However, since the whole point of this was to log the line to the server (using ajax), I could simply read the line of the js file on the server. So it means that you have to ad an extra check on the url of the error to see that it is or is not a javascript file.