?
Solved

How do I change the opening page if the dialog box was opened with shoModalDialog?

Posted on 2007-10-15
3
Medium Priority
?
264 Views
Last Modified: 2009-12-16
If i opened a window with, window.showModalDialog, how can I tell what the name of the window is that opened the Dialog box and how do I reload the opening page with a new page, close the dialog and show the new opening page.

For example if I opened with window.open I could use window.opener.location.href; so in the same manner is there a way to reset the opening page if the page was opened with window.showModalDialog.

I have scanned the web, and so far I found that after the call to the window.showModalDialog I can add the following line of code to force the refresh of the page.  This is not exactly what I asked for, but at the top of the page
I can then redirect to the page I want.  The showModaldialog does not allow refresh of parent page until the Dialog box is closed.  
window.location = window.location;

Let me know if you have any comments on it.  

language javascript:
0
Comment
Question by:swansonplace
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 2000 total points
ID: 20083618
showModalDialog is designed to have a page open a window and have that window return a value.

If you handle everything in the page that opens the dialog, you are just fine.

var url2Load=showModalDialog(....)
if (url2Load !="") location = url2Load;


and in the modalDialog do

returnValue="http://www.someserver.com/somepage.html";
window.close();


http://msdn2.microsoft.com/en-us/library/ms536759.aspx


Alternative is showModelessDialog:
http://msdn2.microsoft.com/en-us/library/ms536761.aspx
0
 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 2000 total points
ID: 20083628
to just reload:


var reloadPage=showModalDialog(....)
if (reloadPage) location.reload(1);

and in the showModal have


returnValue=true;
window.close();

to reload and

returnValue=false;
window.close();

to just close and not reload
0
 

Author Comment

by:swansonplace
ID: 20185416
Thank you.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question