Questions Tags Users Unanswered

preserve child windows on page refresh - window.showModelessDialog

Question is open.
1 answer (2 voices) (7139 views)
Tags:
Child windows opened with 'window.showModelessDialog' goes away when we stitch to another URL in browser..
Can we avoid this?
Any alternative on using 'window.showModelessDialog' to achieve this?

- Shwetank
1 Answer
Hi,

A possible alternative is to use the window.open method instead of window.showModelessDialog. It opens a new application window not a dialog, but an application window works similarly to a modeless dialog. Additionally, the window.open method returns a reference to the opened window and the 'window.opener' property in the opened window refers to the opener window that allow you to communicate between the two windows.

For further details, please see the window.open method and the window.opener property.
I hope that helps. If you have any questions, please feel free to ask.

-------------------------------------------------------------------

EDIT

The new window instance is the only thing that does not go away when the URL changes. Dinamically created elements, dialogs and any other content will go away.
But a possible workaround is to store the open dialogs and reopen them when the document has been loaded. This provides a solution for page reload and when the user goes to another page in your site, but does not solve the problem when the user navigates away from your site.

You can use the localStorage and sessionStorage objects to store data locally within the user's browser. For details, please see:
Web storage (Wikipedia)
DOM Storage guide (MDN)
I will be opening multiple windows one after the other and window.open will create new browser instance each time. I need window.showmodellessdialog like behavior for child windows but also to preserve them on page reload.... Any clue on this? - shwetank -
I've edited my answer. - Dottoro -
15 30 50 per page

Your Answer

Limit of files to attach: 3 / Max total size: 1024 KB
File:
Description:
remove