This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit f144034967312e5f060cfdd55b5fdbfd9bcd637f
Author: Marcus Christie <[email protected]>
AuthorDate: Wed Feb 22 15:22:43 2023 -0500

    AIRAVATA-3688 Fixing onbeforeunload issue with Chrome
---
 .../static/common/js/components/UnsavedChangesGuard.vue        | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/django_airavata/static/common/js/components/UnsavedChangesGuard.vue 
b/django_airavata/static/common/js/components/UnsavedChangesGuard.vue
index 0df81746..9bd38077 100644
--- a/django_airavata/static/common/js/components/UnsavedChangesGuard.vue
+++ b/django_airavata/static/common/js/components/UnsavedChangesGuard.vue
@@ -21,7 +21,15 @@ export default {
     onBeforeUnload(event) {
       if (this.dirty) {
         event.preventDefault();
-        return "You have unsaved changes. Are you sure that you want to leave 
this page?";
+        // Have to return a message for some browsers in order to trigger popup
+        // asking user if they want to leave the page. I don't think any 
browser
+        // displays the message that we return here, but a returned message is
+        // still required.
+        const msg =
+          "You have unsaved changes. Are you sure that you want to leave this 
page?";
+        // For Chrome, set event.returnValue
+        event.returnValue = msg;
+        return msg;
       }
     },
   },

Reply via email to