Auto Close Window

DarkLight's picture

He has: 287 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

All the best news here: https://newsbotnet.com

pr0gr4mm3r's picture

He has: 1,502 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.

DarkLight's picture

He has: 287 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.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.