 |
 |
Javascript: Reloading contents in main browser window from another?
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2000
Location: Baltimore, MD
Status:
Offline
|
|
Hey folks -
Have a little stumbling block in some web development I'm doing using PHP and MySQL. Javascript has never been my strong point, and what documentation I've been able to find isn't doing me any good. I have a case where, using JavaScript, I pop open a new window where a user can do some manipulation of data in the database that would cause the content of the main browser window to change, so I wish to force the main browser window to reload after the user performs the data manipulation in the popup window. I know that by default, the main browser window has no "name", so I use this snippet of code to give it a name:
window.name = 'MainWindow';
In the popup window, once the user manipulates the data, I try to pull one of these to reload the main browser window:
MainWindow.location.reload();
But, nothing happens. I'm sure I'm missing something basic, but I haven't been able to find anything on the web that deals with refreshing the main browser window from a spawned pop-up, only vise versa.
Thanks in advance!
|
|
The Quintessential Featherhead.
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
You could just set a reference in the popup Window to the main window. In the main window do something like this:
Code:
var popupWin = window.open (url,name,widgets);
popWin.parentWindow = self;
Then, in your popup window, you can do:
Code:
self.parentWindow.doSomething();
This is untested, but it should work.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2000
Location: Baltimore, MD
Status:
Offline
|
|
Okay, tried that, and still no reload of the main window.
Here's the code in the main window's HTML:
nested in the HEAD tag of the page, I have:
(Edit: UBB seemed to not display the code properly.  )
Basically, I define a new function to pop the window, then from a link onClick I call the function to pop the window, the function includes the code you provided above. The window pops, but still no reload after the user does theri data manipulation. 
(Last edited by Nyuni; Apr 22, 2003 at 12:16 PM.
)
|
|
The Quintessential Featherhead.
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|