winlineau 06-15-2002, 10:22 AM Look At This:
function reportError(msg,url,line) {
var str = "<center>Err: " + msg + "<br>on line: "
+ line + "<br>URL: " + url + "<br>Web: "
+ navigator.appName + "<br>" + navigator.appName
+ "<BR>" + navigator.appVersion + "</center>";
pop = window.open("","","width=400,height=400");
pop.document.write(str)
return true;
}
window.onerror = reportError;
tim
scroots 06-15-2002, 10:44 AM cool that could be used in conjuction with a form to help debug your website.
very neat.
scroots
winlineau 07-11-2002, 09:18 AM Arn't i the best ;-) (CLUE)
:p :o :o :p
premshree 07-11-2002, 01:09 PM Cool.....but how does the script pass the arguments onError?
mordred 07-11-2002, 01:20 PM The onerror event is in so far special that it automatically passes these three arguments to any handler function defined for that event.
winlineau 07-14-2002, 10:56 AM That is ABSOLUTLY correct!
I love this script. If you combine it with a 'e-mail' script. (IE Sambar Server ect.) you can send the error streight to your inbox!
joh6nn 07-14-2002, 03:14 PM i've actually done that on my site. for me, it's useful, because i have no traffic whatsoever, and it's not a lot of emails to get.
but if you have lots of traffic, and there's a little tiny javascript problem somewhere, then you'll suddenly have a whole bunch of emails in your mailbox
winlineau 07-16-2002, 06:45 AM arrrrrrrr,
That makes my 12YO soul happy ;)
Umm, wrong forum. This belongs in the Post a Javascript category.
BTW, if you want to make it really good, look into the individual error properties.
For example, thanks to resident moderator Alex Vincent, relatively recent Gecko builds (includes NS7, maybe latest NS6) include a "stack" property of an Error() object, which is basically a stack trace. Very useful in debugging.
msimmons 07-16-2002, 03:05 PM Originally posted by joh6nn
i've actually done that on my site. for me, it's useful, because i have no traffic whatsoever, and it's not a lot of emails to get.
but if you have lots of traffic, and there's a little tiny javascript problem somewhere, then you'll suddenly have a whole bunch of emails in your mailbox
I am mainly an ASP (vbscript) programmer so javascript isn't my strong suit. How would one have the page send an email on error?
Thanks in advance,
Michael
joh6nn 07-19-2002, 05:15 AM you set up a server side script that sends email, and a page with a form. you use the error function to copy the important information to the form, and then javascript has a submit() method for forms. so you can use javascript to send the form, which then sends you all of the information from your javascript errors. i also have it set up to fire when i have a 404 error, or a server error
Alex Vincent 07-23-2002, 01:37 AM Originally posted by jkd
For example, thanks to resident moderator Alex Vincent, relatively recent Gecko builds (includes NS7, maybe latest NS6) include a "stack" property of an Error() object, which is basically a stack trace. Very useful in debugging.
Sorry, not in NS6.2. It will be in NS7.
|
|