Forum Moderators: open

Message Too Old, No Replies

Redirect with popup window

         

PeteM

8:53 pm on Jul 20, 2005 (gmt 0)

10+ Year Member



Help!

I have a page1.php with links to page2.php.

On clicking the link to page2.php (from page1.php) I want a small popup window to appear for 5 seconds advising the user that he will be automatically re-directed to page3.php. Then the popup window will close and page3.php will open automatically.

The possibly tricky bit is the only page that I can amend is page2.php. I cannot amend page1.php.

How do I code this?

Thanks, Pete

Dijkgraaf

2:39 am on Jul 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you trying to make page3.php load in the window of page1.php, or in a new window?
Are page1.php and page2.php in the same domain?

PeteM

5:33 am on Jul 21, 2005 (gmt 0)

10+ Year Member



Page3 can load in the same window as page1 or a new window (I don't mind which). Page1 and page2 are always in the same domain.

Whatever technique is deployed must be pop-up stopper proof.

Thanks, Pete

Dijkgraaf

10:26 pm on Jul 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well on page1 you would have

<a href="#" onClick="window.open('page2.php');">click here</a>

In page2.php you would have the following JavaScript to triggered on a timer which you start from onload.

window.opener.location='page3.php'
window.close();

I can't guarantee that it will work with all pop up blockers. It depends how selective they are about blocking window.open. The better ones don't block the ones that require a user action.

PeteM

7:19 am on Jul 22, 2005 (gmt 0)

10+ Year Member



Thanks but I'm afraid I can't amend page1.php! Page1 currently has a link to page2.

Any more ideas?

Dijkgraaf

9:40 pm on Jul 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well how is page1 link currently working?
You haven't told us that.

PeteM

10:10 pm on Jul 24, 2005 (gmt 0)

10+ Year Member



Page1 just has a regular link <a href="#">click here</a>.

Pete

Dijkgraaf

1:44 am on Jul 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well if the href is set to #, it must have some onclick JavaScript function on that link to cause it to open a new window, so the method I gave you should work.

In fact even if they used <a href="page2.php" target=_blank>click here</a> the method I described works.

garann

12:10 am on Jul 27, 2005 (gmt 0)

10+ Year Member



PeteM, can you just do a normal redirect, where page2 contains the message about the user being redirected to page3 and takes care of redirecting them? You won't need access to page1 and you won't have to worry about pop-up blockers.