New Window?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

New Window?

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: New Window?

Post 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.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Post 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?
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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...
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Post by lazersam »

Cool thanks. :P
Post Reply