Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-11-2007, 08:27 AM   #1 (permalink)
charlesming
Recruit
 
Join Date: Oct 2007
Posts: 5
charlesming is on a distinguished road
open new browser code for php

Hi all,

i have the below code currently to redirect-


<?php
header('location:/xxx');
?>



How can i code it such that the new page will open in a new browser window? thanks so much!
charlesming is offline   Reply With Quote
Old 10-11-2007, 09:22 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
you can't use PHP to open a new window. what you're doing there is just changing the header of the current page.

you will need to use javascript to make popups.
__________________
Mike
sde is offline   Reply With Quote
Old 10-11-2007, 04:03 PM   #3 (permalink)
charlesming
Recruit
 
Join Date: Oct 2007
Posts: 5
charlesming is on a distinguished road
i see.. how do we use javascript? in html there is a target_blank.

in this case, should i put in the script on the original page, or the target page?

or perhaps i should just use html to redirect and a open a new page at the same time within the same code?

thanks!
charlesming is offline   Reply With Quote
Old 10-11-2007, 05:38 PM   #4 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
When do you want to open the new window? If you want the window to popup when the page loads, you probably want "onload" attribute of the <body> tag.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 10-12-2007, 04:49 AM   #5 (permalink)
charlesming
Recruit
 
Join Date: Oct 2007
Posts: 5
charlesming is on a distinguished road
basically i am redirecting a current page to a new page. and during the redirect, i want the new page to open as a new browser window.... yup. thanks all
charlesming is offline   Reply With Quote
Old 10-12-2007, 04:51 AM   #6 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 672
DJMaze is on a distinguished road
and due to that have in the other window a blank screen?
That is really useless.
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Old 10-12-2007, 04:57 AM   #7 (permalink)
charlesming
Recruit
 
Join Date: Oct 2007
Posts: 5
charlesming is on a distinguished road
not a blank screen.

I want visitors going to page A to be redirected to page B as a new window, not the existing window.
charlesming is offline   Reply With Quote
Old 10-12-2007, 06:27 AM   #8 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 672
DJMaze is on a distinguished road
So not redirection but just a new/second page/window. That is a whole different story.

Maybe you should first read information about "what does redirect mean"
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Old 10-12-2007, 06:33 AM   #9 (permalink)
charlesming
Recruit
 
Join Date: Oct 2007
Posts: 5
charlesming is on a distinguished road
it IS a redirection. i am not a programmer but i am not that tech dumb, thank you. Maybe you should start taking time to read and try to understand what people are saying instead of shouting your mind off which just makes you look bad.

Anyway for the others, i did a workaround. I cleared the existing page of the code since i dont need it anymore and just put in a line

<a href="http://www.xxx.com/yyyy target="_blank">Click here to continue</a>

if i cant seem to do an auto redirect, i just have to get users to click on the link to move onto the new page.

thanks Belisarius and sde for their comments!
charlesming is offline   Reply With Quote
Old 10-12-2007, 06:46 AM   #10 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 672
DJMaze is on a distinguished road
Some cool stuff to read:

URL redirection - Wikipedia, the free encyclopedia
Links in new windows (target="blank") considered harmful - Anne’s Weblog
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Old 10-13-2007, 09:24 AM   #11 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,705
redhead is on a distinguished road
Or you could do a
Code:
<body onLoad="window.open('http://www.xxx.com/yyyy'); return true;">
In your displayed page source, that would open another window with the page your so called "redirect" should display, eventho, it isn't a redirec as you proclame it to be.

Don't chew out DjM for correcting your recognition of a redirect, he is right and you are wrong, and now I give you permission to chew me out, if that will satisfy your need, but it dosn't change the fact that what you want to do isn't considdered a redirect, it is a pop-up, one of the things most hated on the net these days and most people probably would have a popup killer eliminating your desire to use this "feature"
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 10-13-2007, 10:46 AM   #12 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,486
sde is on a distinguished road
yeah, sounds more like a 'pop-up', not a re-direct.

the term 're-direct' is more for automatically moving a user from one page to another in the same browser window.

since you are technical, and dabbling into programming, i hope you can appreciate the defined distinction. you'll probably find tons of code on google if you search for 'javascript popup'.

you getting all bet out of shap with DJM is like someone going to a mechanic and saying their wheels squeak. the mechanic tells them it's the breaks. then the customer yells at the mechanic saying 'i know what wheels are! and they are squeaking!'
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how the servlet will integrate the LDAP code j.gohel Java 19 04-16-2005 12:55 AM
Code Newbie is taking over my browser! Redline Lounge 4 11-29-2004 02:59 PM
Sun Plans to Open Nearly All of Solaris Source Code redhead Code Newbie News 1 06-30-2004 04:13 AM
Cisco Code breaking sde Code Newbie News 0 05-21-2004 07:10 AM


All times are GMT -8. The time now is 03:55 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting