Follow-up to #1232416: Drupal alerts "An AJAX HTTP request terminated abnormally" during normal site operation, confusing site visitors/editors

Problem/Motivation

If a user navigates away from a page while an AJAX request is running they will get an error message saying "An AJAX HTTP request terminated abnormally"

Proposed resolution

Skip displaying the message if the user deliberately aborted (for example, by reloading the page or navigating to a different page) while the Ajax request was still ongoing. See, for example, the discussion at http://stackoverflow.com/questions/699941/handle-ajax-error-when-a-user-...

Splitted out the patch by David_Rothstein (that was already reviewed and marked RTBC by @Fabianx) from #1232416: Drupal alerts "An AJAX HTTP request terminated abnormally" during normal site operation, confusing site visitors/editors

Added by @droplet:
I understand this patch provided by David_Rothstein only. But we all in #1232416: Drupal alerts "An AJAX HTTP request terminated abnormally" during normal site operation, confusing site visitors/editors spent a hard time on it with the different thoughtful idea & patches.

git commit -m 'Issue #1232416 by hanoii, nod_, heddn, geerlingguy, lokapujya, David_Rothstein, mangy.fox, xurizaemon, timfernihough, jibran, effulgentsia, j0rd, joelpittet, temkin, slashrsm, maxi Todorov, leewillis77, droplet, showrx, orbiteleven, opdavies, rooby, yechuah, shabana.navas, nikunjkotecha, ehj-52n, jhedstrom, sah62, edutrul, rfay, seutje, drupalshrek: Drupal alerts "An AJAX HTTP request terminated abnormally" during normal site operation, confusing site visitors/editors'

Remaining tasks

Commit

User interface changes

N/A

API changes

N/A

Data model changes

N/A

CommentFileSizeAuthor
1232416-341.patch2.07 KBstefan.r

Comments

stefan.r created an issue. See original summary.

stefan.r credited Fabianx.

stefan.r credited hanoii.

stefan.r’s picture

droplet’s picture

Issue summary: View changes
geerlingguy’s picture

Another +1; this patch solves the 80% (probably more) use case—I'm guessing almost all the users in #1232416: Drupal alerts "An AJAX HTTP request terminated abnormally" during normal site operation, confusing site visitors/editors will have their main (annoying) problem resolved.

heddn’s picture

+1

joelpittet’s picture

This is RTBC already but RTBC++ to keep it that way. Reviewed the patch and that looks like a great way to deal with those alerts with manual intervention.

manuel garcia’s picture

+1 this is a huge improvement!

+++ b/misc/drupal.js
@@ -414,6 +414,29 @@ Drupal.getSelection = function (element) {
+Drupal.displayAjaxError = function (message) {
+  // Skip displaying the message if the user deliberately aborted (for example,
+  // by reloading the page or navigating to a different page) while the Ajax
+  // request was still ongoing. See, for example, the discussion at
+  // http://stackoverflow.com/questions/699941/handle-ajax-error-when-a-user-clicks-refresh.

Do we need this link to stackoverflow?

stefan.r’s picture

Issue tags: +Pending Drupal 7 commit
stefan.r’s picture

Title: fix "An AJAX HTTP request terminated abnormally" alert bugs after user has navigated away from the page » Fix "An AJAX HTTP request terminated abnormally" alert after user has navigated away from the page
Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit

Committed and pushed to 7.x, thanks!

  • stefan.r committed 64a69f8 on 7.x
    Issue #2808789 by hanoii, nod_, heddn, geerlingguy, lokapujya,...
David_Rothstein’s picture

Issue tags: +7.51 release notes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.