justuptime.com - monitor your servers & websites

Auto Close Window

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.
Reece S's picture

He has: 169 posts

Joined: Oct 2007

Hi there.
I was wondering if it is possible to Automatically close the current window with PHP. My idea is this...

header("location: FILE");
[SCRIPT TO CLOSE WINDOW]

Because the code will be used on a popup window. and when it starts the Header file, it will close the popup. with me?

The script should work like this:

window.close()'

Or, I would be even happier with something that works like a double header. It redirects to 2 urls at once. The download file, and the thank you page.

Thanks in advance

pr0gr4mm3r's picture
ModeratorSponsor

He has: 544 posts

Joined: Sep 2006

You can't make changes to the browser properties (window size, popup, close) with PHP because PHP is a server-side script. You will have to do it using JavaScript. All you have to do is echo (or print) that JavaScript statement you have in your post.

Hey! It compiles! Ship it!

Reece S's picture

He has: 169 posts

Joined: Oct 2007

yes, I thought that. I have had to use javascript like you said. I used 2 functions, both opened by a single hyperlink.

Cheers Programmer.