diff --git a/misc/ajax.js b/misc/ajax.js index bb4a6e1..3bd2ce1 100644 --- a/misc/ajax.js +++ b/misc/ajax.js @@ -476,7 +476,6 @@ Drupal.ajax.prototype.getEffect = function (response) { * Handler for the form redirection error. */ Drupal.ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { - alert(Drupal.ajaxError(xmlhttprequest, uri, customMessage)); // Remove the progress element. if (this.progress.element) { $(this.progress.element).remove(); @@ -493,6 +492,13 @@ Drupal.ajax.prototype.error = function (xmlhttprequest, uri, customMessage) { var settings = this.settings || Drupal.settings; Drupal.attachBehaviors(this.form, settings); } + + // Muted xhr.abort and unexpected abort trigged by page redirection. + if(xmlhttp.status === 0 || xmlhttp.readyState === 0) { + return + } + + alert(Drupal.ajaxError(xmlhttprequest, uri, customMessage)); }; /** diff --git a/misc/autocomplete.js b/misc/autocomplete.js index d71441b..cb13644 100644 --- a/misc/autocomplete.js +++ b/misc/autocomplete.js @@ -310,6 +310,11 @@ Drupal.ACDB.prototype.search = function (searchString) { } }, error: function (xmlhttp) { + // Muted xhr.abort and unexpected abort trigged by page redirection. + if(xmlhttp.status === 0 || xmlhttp.readyState === 0) { + return + } + alert(Drupal.ajaxError(xmlhttp, db.uri)); } });