> I can't seem to get $(window).error to work the way it seems like it > should. Have a look at the following page: > > http://www.littleshoot.org/errorTest2.html > > It includes the following, and neither error is caught by the $ > (window).error function -- the alert never happens. Anyone know > what's up? > > <script type="text/javascript"> > $(document).ready( function() { > $(window).error(function(msg, url, line) { > alert("Got error"); > }); > throw new Error("Inside doc ready error"); > }); > throw new Error("Outside doc ready error"); > </script> > > Thanks. > > -Adam Fisk
Hmm, I'm not sure that binding the window error event has ever been supported by jQuery. I'd stick with using onerror. window.onerror = function(msg, uri, line) { }