I have a script running in a frame. This script needs to be able to redirect the browser to an entirely different location. However, with the header("locatio n: ") method, only that frame's source is changed. How would I redirect the browser away from those frames?
Changing frame location
Collapse
X
-
Use a JavaScript function and issuewhere 'thatframe' is the name of the frame you want it to be redirected.Code:top.frames['thatframe'].location.href = 'yourpage.htm';
Ronald -
Ok, but this is conditional based on some PHP variable. How do i get it only to issue that command when that PHP if statement passes?Originally posted by ronverdonkUse a JavaScript function and issuewhere 'thatframe' is the name of the frame you want it to be redirected.Code:top.frames['thatframe'].location.href = 'yourpage.htm';
RonaldComment
-
-
Well its pretty simple. So far its just
[php]
if($myVar==$tar get){
header("Locatio n: http://my.server.com") ;
}
[/php]
But this code is running in a frame, so the redirection only applies to that frame's source, instead of the browser itself.
Hope that makes sense...Comment
-
Have you tried this one:[php]<?php
if($myVar==$tar get){
?>
<script>
top.frames['thatframe'].location.href = 'yourpage.php';
</script>
<?php
exit;
}
?>[/php]RonaldComment
-
Comment