Solved

header + target

Posted on 2002-05-25
5
2,203 Views
Last Modified: 2007-11-27
hi,

another prob here.
can i use target in my url when i use header for redirect?

example:
header("location:start.php");

but, start.php will actually load 2 frames (one top, one down), and i only want either the down-frame to reload, or load start.php in _parent (or _self)

(somehow i assume this will require javascript, hope i'm wrong)

cheers
Ricky
0
Comment
Question by:Paurths
  • 2
  • 2
5 Comments
 
LVL 32

Expert Comment

by:Batalf
ID: 7034790
I think you have to use Javascript for this. To reload one frame with javascript:

in start.php:

<script>
top.frames[1].location.href='newUrl.html?random='+Math.random();
</script>

You could also use location.reload() to reload the frame.

Batalf
0
 
LVL 7

Expert Comment

by:axis_img
ID: 7034798
This sounds like a javascript solution to me as well... I would have to see more of the setup to know for sure though. You can't use target in a php header, unfortunately. The header will simply redirect to the page specified, and only in the frame that contains the header.

There may be another solution though, but please post a little more detail about what you are trying to do.

Thanks
Barry
0
 
LVL 7

Accepted Solution

by:
axis_img earned 100 total points
ID: 7034809
"or load start.php in _parent (or _self)"

Is this always the case? start.php will ALWAYS need to open in the parent, and not be contained within a frame?

If so, then you may be able to simply do the following inside the start.php script:

Add this javascript line into start.php, which will force start.php to reload itself as the parent when it is called.

<script language="javascript">
if(top!=self){top.location=self.location;}
</script>

I am not sure if this is what you are talking about. Let me know.
0
 
LVL 12

Author Comment

by:Paurths
ID: 7034815
thanx barry,

that did it,

i'm sure i can use in a couple of other cases i've run into trouble with this.
i've only been using php for 4 days or so now...
html/asp a little longer (couple of years) but never learned javascript
i guess its time for that.

u guys are great.

cheers
Ricky
0
 
LVL 12

Author Comment

by:Paurths
ID: 7034817
btw, batalf,

your example 'seems' to work (seems logic) but it only refreshed the top-frame (even if i change the 1 to 0, or to the frame-name)

cheers
Ricky
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 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

17 Experts available now in Live!

Get 1:1 Help Now