PDA

View Full Version : email window.onerror??


hogtied
03-27-2003, 12:55 AM
Hello members,

I was wondering if it were possible to email window.onerrors instances?

I thougth about mailto but the user would have to send it. Then i thought about SSI but how do you call a cgi script without redirecting them to it, AND to specifically call it. Meaning only call the SSI when an error has occured..

I tried the :
include and execute, but they both get processed no matter what. I only what they to run on error...

Anyway???

If this can't be done then where best to put the include.? within the error function? so that it may retreive all the information??

Thanks
Hogtied

liorean
03-27-2003, 12:59 AM
You can in moz/ie, using XMLHttpRequest in moz and ActiveXObject('Microsoft.XMLHTTP') in ie. With them, you can send a string to the server - and recieve the response - without reloading or leaving the page.

joh6nn
03-27-2003, 01:46 AM
i pass the onerror info to a cgi-script, which mails the info to me. another alternative is to use the cgi-script to write the info to a log file.

glenngv
03-27-2003, 02:04 AM
i used this in my intranet site:


window.onerror=errorHandler;
function errorHandler(reason,page,line) {
msg='A JavaScript error has occurred on the page:\n '+page+'\n\nOn line #:\n '+line+'\n\nFor the reason:\n '+reason;
alert(msg);
err = new Image();
err.src="error.asp?e="+escape(msg);//call server-side script to email error
return true;
}

hogtied
03-27-2003, 12:06 PM
kewl thanks guys.. you know just recently I started to see server side includes being called from image sources. Find it a bit weird but as long as it works. Great I'll give it a try.....