In the past, I've sent this info back to a CF template which could then process it in
any way needed. Here is the JS code I included with my JS library. Watch out for the
big line wrap on the query_string assignment line!
===START===
var errCount = 0;
function errHandler(msg,url,line) {
if (document.images) {
var par_url = parent.location.href;
if (par_url == location.href) par_url = 'no parent';
query_string =
'http:\/\/www.yoursite.com/JSErrorReport.cfm?url='+escape(location.href)+'&parent='+escape(par_url)+'&referrer='+escape(document.referrer)+'&browser='+escape(navigator.appName+'
'+navigator.appVersion)+'&msg='+escape(msg)+'&line='+escape(line)+'&count='+(++errCount);
var reporter = new Image();
reporter.src = query_string;
}
return true;
}
window.onerror = errHandler;
===END===
The JSErrorReport.cfm template just captures the URL variables and then you're
set--log them, throw them in a DB or email them to an admin.
Chris
> -----Original Message-----
> From: Hugo Ahlenius [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 23, 2003 10:06 AM
> To: CF-Talk
> Subject: Javascript error catching
>
>
> Hi,
>
> I have this idea to improve the quality of a heavy DHTML/Javascript
> application -- Storing some important variables (browser, OS,
> screen size)
> from javascript when window.onerror function is triggered.
> This could be
> stored in a db, or just in a log-file. (One could, onerror, trigger a
> function in a hidden frame that passes these, in a request, to the
> server).
>
> Has anyone done this? Any code that could be re-used perhaps... ?
>
> /Hugo
>
>
>
>
> -------------------------------------------------------------
> Hugo Ahlenius E-Mail: [EMAIL PROTECTED]
> Project Officer Phone: +46 8 230460
> UNEP GRID-Arendal Fax: +46 8 230441
> Stockholm Office Mobile: +46 733 467111
> WWW: http://www.grida.no
> -------------------------------------------------------------
>
>
>
>
> ###########################################
>
> This message has been scanned by F-Secure Anti-Virus for Microsoft
> Exchange.
> For more information, connect to http://www.F-Secure.com/
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Host with the leader in ColdFusion hosting.
Voted #1 ColdFusion host by CF Developers.
Offering shared and dedicated hosting options.
www.cfxhosting.com/default.cfm?redirect=10481
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4