Solved

PHP Header redirection

Posted on 2003-12-11
3
786 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

615 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