MDL-58835 report_insights: Force window reload when no more predictions
[moodle.git] / report / insights / amd / src / actions.js
index bc10ce2..3c98868 100644 (file)
@@ -57,7 +57,11 @@ define(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notificat
 
                         // Move back if no remaining predictions.
                         if ($('.insights-list tr').length < 2) {
-                            window.history.back();
+                            if (document.referrer) {
+                                window.location.assign(document.referrer);
+                            } else {
+                                window.location.reload(true);
+                            }
                         }
                     }).fail(Notification.exception);
                 }