JavaScript: Overriding alert()

It’s definitely “supported”. It is your web page, you do whatever you want to with it. I already did this to track analytics events without modifying a library but by sneaking into events. Use the proxy pattern: (function(proxied) { window.alert = function() { // do something here return proxied.apply(this, arguments); }; })(window.alert); You can also … Read more