Normally when a window is opened using window.open I can access the caller window by using window.opener(), is it possible do the similar within modal dialogs(window.showModalDialog)?
As you can read in a comment on the MSDN page about showModalDialog (thanks to Pekka),
[t]he
window.openermethod returnsnull, rather than a reference to the opening window. So you cannot refresh the opening window withwindow.opener.location.refresh()(if, for instance, you useshowModalDialogto open an editing dialog). If all you want to do is refresh the opening window every time theModalDialogcloses, that is easy (includewindow.location.refresh()right after the call toshowModalDialog). But if you only want to refresh the opening window in certain cases (e.g., the opening window takes a while to refresh), you can do that by passing adialogArgument.A more clever (I think) way is to pass the window reference itself as the
dialogArgument. In the calling window, usewindow.showModalDialog('newurl.asp', window). In the called dialog retrieve the reference withvar window_opener = window.dialogArguments. You can use the window reference stored in variablewindow_openerin place ofwindow.opener, to refresh the calling window from the called dialog.Do note that Firefox and Chrome (for instance) do not appear to have these limitations, and appear to treat
ModalDialogsmore like regular windows. Keep that in mind if you do testing using one of these browsers, but intend your application to work in all browsers.