tags:

views:

933

answers:

4

I have a html page A and a link in the page which opens up page B in a new window. How to reload the page A on clicking and opening this link ?

EDIT:

I should have been more clear. Page B opens in a new window and not as a popup. The hyperlink in question has its target attribute set to _blank. Taking a clue from the answers that I got (Thanks guys !), I tried setting onclick = "window.location.reload()" and it works perfectly fine.

However I have a problem. In fact another question altogether. How to make sure that the reload of page A waits until the page opened in the new window (page B) loads ?

+1  A: 

The simplest way would be to do

<a href="# " onClick="window.open('newPage.htm','window','width=400,height=200')">link</a>

If I remember correctly that should open the window and then since the return has not been suppresed will reload load the page.

Mark Davidson
+1  A: 

I am not exactly sure if this is what you want based on your wording, but if you want to reload the opening window from a link in the popup try

self.opener.location.href = self.opener.location.href;

Edit, based on your new comments just use the code above in the body onload of the new window

<body onload="self.opener.location.href = self.opener.location.href;">
Bob
+3  A: 

Something like this:

<a href="javascript:window.open('pageB.htm');window.location.reload();">open page b</a>
M4N
A: 

You can use setTimeout() to delay the reload.

Kon