Page 1 of 1

New Window?

Posted: Fri Nov 18, 2005 4:43 am
by lazersam
Hi all

I want to open a new browser window using a header() statement - is this possible?

Presently I am using...

Code: Select all

header("location:../message.php");
		exit();
Larry.

Re: New Window?

Posted: Fri Nov 18, 2005 4:54 am
by Chris Corbyn
lazersam wrote:Hi all

I want to open a new browser window using a header() statement - is this possible?

Presently I am using...

Code: Select all

header("location:../message.php");
		exit();
Larry.
Not possible I'm afraid.

The things that go in header() are simply HTTP headers so that wont work...

Before today it could have been done with javascript but that doesn't work most of the time these days due to popup blockers. The only way to launch a popup (fairly) is to have the user click something.

It's crafty and unfair IMO but you can still launch popups with embedded Java applets I believe.

Posted: Fri Nov 18, 2005 5:00 am
by n00b Saibot
No. you can use javascript to open a new window or write a link to open that page in new window...

edit | uh huh... too late

Posted: Fri Nov 18, 2005 5:04 am
by lazersam
Ok, before the script opens my message.php page, can you give an example of code (either java or html) that will force the message.php to open in a new browser?

Posted: Fri Nov 18, 2005 5:10 am
by n00b Saibot
JavaScript code:

Code: Select all

newWin = open("message.php", "NewWin", "width=200, height=100, resizable=1, scrollbars=1");
newWin.focus();
in HTML you would output a link with target="_blank" that would have to be clicked by the user to open it in new window...

Posted: Fri Nov 18, 2005 5:17 am
by lazersam
Cool thanks. :P