pthurmond Posted November 26, 2006 Share Posted November 26, 2006 Can the header function be used to open a file in a separate window? I currently use them to redirect to another page within the current window. I would like to open some pages in a new window. Any ideas?Thanks,Patrick Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/ Share on other sites More sharing options...
JasonLewis Posted November 26, 2006 Share Posted November 26, 2006 i'm not sure about that one. i dont think so, well not to my knowledge. i looked at the php site but found nothing, unless i didnt look hard enough. Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130414 Share on other sites More sharing options...
taith Posted November 26, 2006 Share Posted November 26, 2006 you'd want to use javascript[code]<?function popup($text, $link, $name="myWindow", $height="300", $width="300", $resizable="0", $status="0", $class=""){ return '<a href="#" onclick=\'javascript: window.open("'.$link.'", "'.$name.'", "status='.$status.', height='.$height.', width='.$width.', resizable='.$resizable.'")\' class='.$class.'>'.$text.'</a>';}?>[/code] Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130440 Share on other sites More sharing options...
pthurmond Posted November 26, 2006 Author Share Posted November 26, 2006 The problem is I have a script that has to store some data in the session data first and then redirects to a page that uses that data. The problem is I want the first page to open in the same window, but the redirected to page to open in another window. So I need it to automatically redirect to the page in a new window once it successfully processes the data.Any ideas.Thanks,Patrick Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130675 Share on other sites More sharing options...
spelltwister Posted November 26, 2006 Share Posted November 26, 2006 you want to open a file literally or just change the page url for that separate window?I really can't tell what you're after Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130677 Share on other sites More sharing options...
pthurmond Posted November 26, 2006 Author Share Posted November 26, 2006 I want to open that page in another window. That page produces a report from information in the database. Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130681 Share on other sites More sharing options...
trq Posted November 26, 2006 Share Posted November 26, 2006 As has been said, you'll need to use Javascript. php doesn't eben know what a browser is let allone a new window. Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130685 Share on other sites More sharing options...
pthurmond Posted November 26, 2006 Author Share Posted November 26, 2006 The problem is javascript as far as I have seen requires the user to click on a link to do this. I need this done on the server side as soon as the user submits valid data. Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130689 Share on other sites More sharing options...
spelltwister Posted November 26, 2006 Share Posted November 26, 2006 you can have the javascript in the body for onLoad = 'javascript:whateverfunction()'when you have your original page redirect, have the if($_POST['submit']){ around the javascript function that way it will only fire if the redirect was from the origianl submit. You can also add in error handling. Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130691 Share on other sites More sharing options...
mainewoods Posted November 27, 2006 Share Posted November 27, 2006 if you use the body onload="" to pop up a new window, most popup stoppers will stop your popup! You should try to find a way to do it all in one window, keeping the current window and popping up a new window will fail in most cases because of popup stoppers. Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130756 Share on other sites More sharing options...
ToonMariner Posted November 27, 2006 Share Posted November 27, 2006 you are also relying on js being on! admittedly this true the majority of the time but you should deisgn your site so that it doesn't need js and then add that on as an improvement for the vistors experience. Link to comment https://forums.phpfreaks.com/topic/28496-redirecting-to-a-new-window/#findComment-130770 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.