0

I have a parent caller page and a modal page, when the modal page is closed, the caller page gets a returnValue from the popup modal page. Even older version Chrome's showModalDialog() always returns undefined, there are many workarounds [javascript - showModalDialog not returning value in Chrome.

But now window.showModalDialog() in Chrome37+ is deprecated by design [http://blog.chromium.org/2014/07/disabling-showmodaldialog.html], those workarounds to get returnValue of a popup window do not work anymore.

Than I tried window.open(), but window.open act quite differently from showModalDialog, and its not easy to get the correct returnValue (since window.open() is asynchronous).

So is there a perfect way to solve this?

Community
  • 1
  • 1
Sam Su
  • 6,532
  • 8
  • 39
  • 80

1 Answers1

0

You can use the Jquery Modal Dialog Framework

JQuery Modal Dialog Example

$( ".selector" ).dialog({
    close: function( event, ui ) {
        alert('dialog closed');
        return;
    }
});

Or the Fancybox Framework

Fancybox Example

$(".fancybox").fancybox({
    afterClose : function() {
        alert('dialog closed');
        return;
    }
});

Both frameworks provide callback handlers so that you can store or pass values to other functions...

bastos.sergio
  • 6,684
  • 4
  • 26
  • 36