Paul's Programming Notes     Archive     Feed     Github

Stop IE Alert Messages

The following snippet of Jquery will prevent alerts from showing in internet explorer:

if ($.browser.msie) { window.alert = function() { }; };

It detects if the browser is IE, then disables the alert function with a blank if it is IE. The alert happens only in IE, that's why it checks to see if the browser is IE.

I did this because there is some code I can't change on a sharepoint page which is causing an alert (which doesn't actually cause any real issues). Adding this code to the part of the page I can change will stop the error.

About the alert:
It says "Hit error fn!" and it happens in the following span after an ajax call fails: <span id="ctl00_LogUserActivity1">

It's definitely a hack, but it works so far.