So I'm using Gritter for notifications throughout a site, and was wondering if there was a simple way to intersept all the alert() s thrown by any script, with jQuery, and reformat the value of the alert to the body of a Gritter notification?
            Asked
            
        
        
            Active
            
        
            Viewed 1,948 times
        
    1 Answers
8
            You can replace the alert function and do whatever you want with the arguments:
window.alert = function (message) {
    $.gritter.add({
        title: 'Message for you sir!',
        text: message
    });
};
        Magnar
        
- 28,550
 - 8
 - 60
 - 65
 
- 
                    Browsers should probably have this by default :D – bhagyas Jun 28 '11 at 09:53