Solved

PHP Header redirection

Posted on 2003-12-11
3
778 Views
Last Modified: 2011-10-03
When using either of the following headers, can you make it open in a new window? (i.e. target=_blank)?????

header('Location: http://www.example.com');

or

header('Refresh: 5; url=http://www.example.com');


Probably very easy, just can't put my finger on it,

Thanks!
0
Comment
Question by:Wiired
3 Comments
 
LVL 13

Accepted Solution

by:
lozloz earned 50 total points
ID: 9925058
nope not to my knowledge, you'll need to use some javascript to do that. and i don't think your 2nd header syntax is correct - that looks like a javascript-esque string in a php function to me

first page:

<?
// your code
header("Location: example.php");
exit;
?>

example.php:

<html>
<head>
<script language="JavaScript">
<!--
function open_window(theURL,winName,features) {
  var a=window.open(theURL,winName,features);
  a.focus();
}
//-->
</script>
</head>
<body onLoad="open_window('http://www.example.com','example','scrollbars=yes,width=720,height=550,resizable=yes');">
<?
// your second page goes here
?>
</body>
</html>

hope that helps

loz
0
 
LVL 1

Expert Comment

by:Rayni
ID: 9925599
You could aslo try

<head>
  <META HTTP-EQUIV="Refresh" CONTENT="3; TARGET=_blank; URL=http://www.some.org/some.html">
</head>

- Daniel
0
 
LVL 6

Expert Comment

by:DoppyNL
ID: 9927258
you can't do it with headers or with a refresh.
You will have to use some sort of client side scripting like javascript.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now