Using Web Dialogs in IE

Opening a new browser window is a handy but sometimes misused feature. Eventually, your user ends up with tons of open browser windows they just forget about.

Sometimes a Web dialog will do the job better. There are two kinds of Web dialogs available: modal and modeless. Modal dialogs (available in IE 4+) will not let the user go back to the browser window until the dialog is closed. Modeless dialogs (IE5+) will let the user back to the browser, but the dialog will stay on top. Most users won’t lose track of a Web dialog but will forget a new window.

Dialogs are great for getting a little more information from the users before performing an action. For example, if the user clicks a button to “Show my Purchase History,” you may want to find out which product line to show. Pop up a modal dialog with a combo box and ask!

Here’s how to open a modal dialog:

 window.showModalDialog("path/page.htm", null,      "dialogHeight:100px; dialogWidth: 200px; help:yes; 
scroll:yes;"+ "resizable:yes")

You can even pass parameters back and forth. Substitute a value or variable name for the null in the second argument to showModalDialog (above). Then, to retrieve the value in the dialog, use:

 //this is in page.htm (the dialog)   //retrieve the argument   var theArg = window.dialogArguments   //return a value to the calling window   window.returnValue = "I'm a return value"

To catch the return value in the calling window, use:

 var theReturnValue = window.showModalDialog( etc... )

To create a modeless dialog, just change the code above to call the showModelessDialog method (IE5+). Again, modeless dialogs will let the user switch focus back to the calling browser window, but the dialog will still stay on top.

Dialogs can do almost anything that a Web page can do, so get creative!

(Note: Check out the MSDN references for modal dialogs and modeless dialogs.)

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a