RSS

Category Archives: html

Find out where this JS Alert is invoked

Ever run into a situation where you have an alert popping up from JavaScript and your not sure where it is coming from. Here is a good technique for forcing a stack trace on all alert()‘s by overriding the Alert function.

var old = alert;

alert = function() {
    try {
        throw new Error;
    } catch(e) {
        console.log(e.stack);
    }

    old.apply(window, arguments);
};

Original Article:  http://stackoverflow.com/questions/7808665/how-to-find-out-where-the-alert-is-raised-from

Advertisements
 
Leave a comment

Posted by on April 29, 2012 in html, javascript, personal, web