![]() |
Window.opener refresh/reload
I have a page (index.asp) that lists entries from a database.
This page then opens another Window (using javascript). This then adds another record to the database (filename is addJob.asp). What I need to do is Close this window BUT refresh the opener (index.asp) which will show the newly inserted record. Ive managed to get the following working on index.asp javascript:window.close();window.parent.document.location.reload(true); but not on addjob.asp. Any suggestions? |
If you close the window before the reload, the reload won't process.
|
before closing the child window, execute opener.location.href = <the url and querystring of the parent page>
|
it's easily doable and you don't need gimmicks like url matching to do it.
post the popup code and i can help specifically, but in general, there's only one snag to doing this easily: you need to call popup.close() from the opening page. you can do an onsubmit event on your popup's form that calls a function on opener that 1. popup.close()es the data entry form 2. reloads itself (location.href=location.href) maybe something like this: on the opening page: Code:
var popup=window.open("page2");Code:
<form onsubmit="opener.finish()" ... > |
Good point about the URL-matching, it is not necessary if parent is reloading the same url.
So if you want to let the child window manage itself independently, then the child can simply execute: opener.location.href = opener.location.href; self.close(); less complicated than the self.finish function and modifying onsubmit. |
| All times are GMT +1. The time now is 10:21 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.