0
votes

What I want to do is the following

      window.onbeforeunload = function (e) {
          return 'Dialog text here.';
          Ext.Msg.confirm("Confirmación", "Seguro que quieres salir", function (btnText) {
              if (btnText === "yes") {                
                 App.direct.RegistrarAbandono();
              }
          }, this);
      };

that is, I want that if the person leaves the browser to be able to delete or do some action from the server and notify the person who will have some consequences for avandonar the form.

thank you very much

1
You cannot halt/pause window.onbeforeunload event.So no use of showing dialog box here.Tejas
AND A POSSIBLE SOLUTION? OR WAY TO DO WHAT I WANT?Duban Ortiz
Thing which can do is you can only change message present on beforeunload dialog box.And I think you should show some message like changes cannot be saved.Tejas

1 Answers

0
votes

Try using below code:

Ext.EventManager.on(window, "beforeunload", function (e) {
                 Write your code here
        }, this, {});