-1

since window.showModalDialog doesn't work on chrome, I'm using it in case of firefox and in chrome I'm using window.open but my problem is that the return value of window.open is undefined maybe because the javascript continue before i close the child window so I tried to put the code in this condition if (returnValue.closed) .. but the problem is that the child window is loading all the time and i can't choose my value from it.

This is my code:

if (window.showModalDialog) {
   var retVal = window.showModalDialog(...)

if (!window.showModalDialog) {
 var retVal = window.open(...);
            while (a == 0) {
                if (retVal.onload()) {
                    if (retVal.closed) {
                        if (retVal != null) {...
                        }
                    }
                }
        }
    }

Any help is highly appreciated.

Youmna Habchy
  • 107
  • 2
  • 4
  • 17
  • Whoah, dude. Your question is not clear here. Please break your code out into code blocks and maybe add some punctuation to your question if you can. :) – Jackson Egan Oct 20 '14 at 06:35
  • 1
    Possible duplicate of [How can I make window.showmodaldialog work in chrome 37?](https://stackoverflow.com/questions/25663053/how-can-i-make-window-showmodaldialog-work-in-chrome-37) – Kuncheria Jul 26 '19 at 05:54

1 Answers1

1

showModalDialog is a deprecated feature. You can see http://blog.chromium.org/2014/07/disabling-showmodaldialog.html for more details.

I recommend you to use another option (from many available out there) of a javascript "popup" that will also "freeze" the rest of the page like:

And you will need to find another way to pass the return value back to your page, depending on the option you choose to use.

SmartDev
  • 2,802
  • 1
  • 17
  • 22
  • Thank you for your help I'm using the first option https://github.com/niutech/showModalDialog but the problem is that arguments of the function are lost after using the open.showModal Dialog. I mean if i want to set the return value in textbox by document.getElementById(one_of_the_function_arguments) it's not working because this argument is lost in google chrome only!!! Do you have any idea why?? Thanks again – Youmna Habchy Oct 22 '14 at 07:43