Does anyone know how to figure out if a window was opened by window.showModalDialog()
? window.opener
returns the parent window when the new window is opened by window.open()
, but for some reason when you use window.showModalDialog()
, window.opener
returns as undefined. jQuery solutions are also welcome.
Asked
Active
Viewed 3,058 times
4

ryanulit
- 4,983
- 6
- 42
- 66
1 Answers
4
You can check if window.dialogArguments is defined:
function isModalWindow()
{
return (window.dialogArguments != null);
}

Frédéric Hamidi
- 258,201
- 41
- 486
- 479
-
1Thanks. I actually used if(typeof window.dialogArguments != 'undefined') for our specific case, but this got me going in the right direction. – ryanulit Nov 19 '10 at 14:41