I'm am using Visual Studio 2010 to override JS alert box with a custom modal box.I've used following :

(function() {
  var proxied = window.alert;
  window.alert = function(txt) {
  //myFuntion(txt);
  return proxied.apply(this, arguments);
  };
})();

this Js function is causing both my custom pop up & alert box to be displayed. Source taken from here while

  window.alert = function(txt) {
  //myFuntion(txt);
  };

works just fine for aspx page scripts. The problem is Js alert dynamically added by code behind using RegisterStartupScript and RegisterClientScriptBlock are still showing native alert box.How to resolve this.

Related posts

Recent Viewed