Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP Header redirection

Posted on 2003-12-11
3
Medium Priority
?
789 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 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

715 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