Forum Moderators: open

Message Too Old, No Replies

Open window & Refresh parent window?

         

adammc

6:20 am on Sep 5, 2006 (gmt 0)

10+ Year Member



Hi Guys,

I am a little stuck as to how to open a new window & refresh the parent window using javascript.

1. User clicks link which opens a new window
2. Upon clicking the link the parent window is refreshed.
3. The user is able to click a link in the window that opened (close window)

I have tried using this to refresh the window in the page that opens:

<a href=\"javascript:top.close();top.opener.location.reload();\" class=headings title='continue shopping'>Continue Shopping</A>

And this to open the window:

target='new'>

Apart from not refreshing as soon as the window is opened (obviously), I have received warnings from the browser saying that the webpage is tryign to close the window.

Can anyone possibly help with this?

daveVk

8:08 am on Sep 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure I understand question, perhaps change order of statements as you refer to 'top' after closing it.

Change link to

<a href=\"javascript:top.opener.location.reload();top.close();\" class=headings title='continue shopping'>Continue Shopping</A>

adammc

11:34 pm on Sep 5, 2006 (gmt 0)

10+ Year Member



Sorry for the confusion.

I am basically after the javascript code that will allow me to open a new window (on page 1) using a link and at the same it opens a new window (page2) it refreshes page1.

Then on page 2 I want a link to be able to close page2 so the user can return to page1.

daveVk

11:35 am on Sep 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



on page 1, to open page 2 on new window

<a href="/page2.html" target="_blank" >To Page 2</a>

on page 2, when it loads refresh page 1.

<body onload="top.opener.document.location.reload();" >

also on page 2, to close window.

<a href="javascript:top.close()" class="headings" title="continue shopping">Continue Shopping</a>