This is the smaller version of the client-side code to capture Javascript errors. See description here.
This version does not save code snippets, but does crunch down to 267 bytes. The full-featured version requires 678 bytes of minimized Javascript.
// !!!! IMPORTANT !!!!
// This must be the first script that runs.
// It cannot catch errors in script that
// appears higher up the page.
onerror = // assign our own handler to the Window.onerror event
function(d, p, l) // d: Error Description; p: Path; l: Line
{ // NOTE!! ScriptCanary will only log requests from registered customers.
// See http://ScriptCanary.com
// ScriptCanary version number
new Image().src = "http://ScriptCanary.com/log.aspx?v=1" +
// Error Description
"&d=" + encodeURIComponent(d) +
// Error Line #
"&l=" + l +
// User Agent
"&u=" + encodeURIComponent(navigator.userAgent) +
// OS/Device
"&o=" + encodeURIComponent(navigator.platform) +
// URL
"&p=" + encodeURIComponent(p) +
// Random # to circumvent caching
"&r=" + Math.random();
onerror = null
}
0 comments:
Post a Comment