can i set target of file while redirecting 2 it using header

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
saadatshah
Forum Newbie
Posts: 23
Joined: Fri Jul 05, 2002 5:50 am
Location: Lahore

can i set target of file while redirecting 2 it using header

Post by saadatshah »

Hi All,
can any1 gimme solution abt this...i wanna redirect user to some page but at the same time i want that page 2 b open in a new window....so is there any way to do this....


header("Location: somefile.php"); -----> opens the file in the same frame....i want it 2 b open in a new window....


so hopin 4 a favorable response.....


Saadi
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

javascript. php can't do that.
Elfstone
Forum Newbie
Posts: 21
Joined: Tue Jun 11, 2002 2:25 am
Location: NJ, USA

Post by Elfstone »

In case you're wondering the javascript looks like this:

<script language="JavaScript">
<!--
function openwin(url, name)
{
settings=
"toolbar=yes,location=yes,directories=yes,"+
"status=yes,menubar=yes,scrollbars=yes"+
"resizable=yes";

MyNewWindow=window.open("http://"+url,name,settings);
}
//-->
</script>

To forward your user as soon as a page loads you would add this to the body tag:
onLoad="openwin('www.yourpage.com','Window Name');"

To forward a user when a link is clicked you would use this as your <a> tag:
<a href="#" onClick="openwin('www.yourpage.com','WindowName'); return false">


Just be sure you don't put a space in your WindowName.
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

or you can just stick with

<body onload="window.open("url");">

im pretty sure that would work..
Post Reply