09 March 2011

IE window.showModalDialog() - Cross Browser solution

Hello,

QUESTION: How to make window.showModalDialog() work on cross browser? or at least how to do something similar? with arguments, return value and window.close()?

ANSWER: There is no simple way to do that.

ATTENTION: dialogArguments will be lost if the page inside the popup will do a postback. For a better solution see my new version - click here.

First of all window.showModalDialog() function is something which works only on Internet Explorer and in the best case this command will open a new small window on some browsers, however this window is far from a modal window.

If you still need to have the same functionality as window.showModalDialog(), to pass some parameters / arguments to the page inside the popup and then return some values back from that page in the parent page, and also have the ability to close the popup from the inside of the popup then this article is for you.

Here I have created a modal popup, using jQuery, which gives you the ability to pass arguments to the page inside the popup almost in the same way as you would pass it through showModalDialog().

23 January 2011

IE window.createPopup() - cross browser solution

Hello,

Probably a lot of you came to the situation when you needed to have a popup as the one which IE is providing when using window.createPopup().

I have surfed a lot on the internet, but I couldn't find a solution that would satisfy my requirements. This is why I decided to create my own library in Javascript. I will provide the code of it below in this post.

Note: jQuery is used in this code, this is why you will need first of all to include jQuery library (Core & UI) before below code.

Need more? Leave comments and subscribe to my blog.

.