How to refresh all pages in a frameset

arwa picture arwa · May 19, 2010 · Viewed 7.1k times · Source

Using PHP I would like to force the browser to refresh all pages (frames) in the frameset, as if the user had pressed the F5 button.

When I use

header("Location: frameset.php"); 

it reloads the whole frameset into one frame.

Answer

Jonathan Kuhn picture Jonathan Kuhn · May 19, 2010

Yes, stay away from frames if at all possible. PHP can't really do this using a header redirect, you would have to use javascript to target the parent frame and reload that. So something like:

<script type="text/javascript">
parent.location.reload();
</script>