Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you refresh a page from a pop up? 1

Status
Not open for further replies.

meeble

Programmer
Sep 24, 2002
137
GB
Hello.

I have a page that opens a pop up when you click on a link. In this pop up, is another link, that, when clicked, closes the pop up and refreshes the main page.

Is this possible?

Cheers

James
 
put a function in your main window like this:
Code:
function refreshPage() {
   self.reload();
}
and in your popup, put your link you mentioned like this:
Code:
<a href="javascript: void(0)" onclick="opener.refreshPage()">

alternatively, you might wanna try in the onclick of the link in the popup, something like this:
onclick="opener.self.reload()"
but that syntax doesn't look right to me. However, I know the example showed above will work.

-kaht

banghead.gif
 
Use window.opener.location.reload(); before window.close();
 
I tried:

function refreshPage() {
self.reload();
}

in the main window

and

<a href="javascript: void(0)" onclick="opener.refreshPage()">

in the popup link but this just brings up the JavaScipt error:

"Object doesn't support this property or method"

What is wrong?

Cheers

James
 

Does changing this:

Code:
<a href="javascript: void(0)" onclick="opener.refreshPage()">

for this:

Code:
<a href="javascript:void(0);" onclick="window.opener.refreshPage();">

make any difference?

Dan
 
None at all I'm afraid...

Still the same error message
 

I am assuming that you correctly copied the refreshPage function into your main window, as kaht suggested. Failing that, try this:

Code:
<a href="javascript:void(0);" onclick="window.opener.document.location.reload(true);self.close();">

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top