ssDialogFix

fixes for IE Modal/Modeless Dialogs

Background

Internet Explorer has a couple non-standard extensions to the window object: window.showModalDialog() and window.showModelessDialog(), both of which create true dialog-type windows.  These dialogs are much better suited than normal windows (as created by window.open()) for use in web applications. 

Unfortunately, though, these dialogs have several annoying bugs and limitations:

Introduction

So with these bugs in mind (and inspired by a fix for one which I saw somewhere, but now forget), I put together ssDialogFix, which simply consists of a single JScript function you can include and call in IE as the page loads.  It automatically detects if it's in a dialog (rather than a normal window), and fixes most of the bugs.  The fixes are totally transparent after that.  No further adjustment of code is needed.

Usage

  1. Include dialogs.js in your page:
    <script language="javascript" type="text/javascript" src="dialogs.js"></script>
  2. In script, call fixDialog.  Example:
    <script language="javascript" type="text/javascript">
    fixDialog();
    </script>
    To enable the custom context menu (it remains disabled by default), pass a boolean value of true to fixDialog: fixDialog(true);

the fun stuff

Run demo, See demo source, Get dialogs.js

Notes

History

Support

As-is, etc.  (But ask real nice & I might help anyway.)  Suggestions are always welcome.

credits/author

-Rob (@slingfive) Eberhardt, Slingshot Solutions
Use freely, but be honest about it.  I just ask for credit.

slingfive.com