Page 1 of 1

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

Posted: Sat Aug 17, 2002 12:34 am
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

Posted: Sat Aug 17, 2002 12:48 am
by hob_goblin
javascript. php can't do that.

Posted: Sat Aug 17, 2002 1:26 am
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.

Posted: Sat Aug 17, 2002 6:33 am
by hob_goblin
or you can just stick with

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

im pretty sure that would work..