Can you refresh an entire page, from within an iframe?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Can you refresh an entire page, from within an iframe?

Post by simonmlewis »

I have an iframe inside a PHP page that refreshes every 10 seconds.
But it needs to be able to dominate the PHP file under certain conditions.

One query needs to be able to refresh the overall PHP file and perform a function.

How do you refresh the page (redirect, or however you wish to term it) that is the 'parent' page holding the iframe?

I've seen many Javascripts but they all seem terribly complicated. I am sure there must be a way to do this easier.
Rather than using this which just refreshes the frame itself:

Code: Select all

<meta http-equiv='Refresh' content='12 ;URL=frame.php'>
Is there something like that, that does the Parent?

Thanks.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Can you refresh an entire page, from within an iframe?

Post by simonmlewis »

Just found this, but cannot see how it can be interpretted to use the 'parent' target.

Code: Select all

<script type="text/javascript"><!--
setTimeout('Redirect()',4000);
function Redirect()
{
  location.href = '../htmljavascript.htm';
}
// --></script>
I am NOT looking for Javascript, so this is the correct thread, unless someone knows better.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Can you refresh an entire page, from within an iframe?

Post by McInfo »

If you don't already have Firebug, I highly recommend installing it.
simonmlewis wrote:I am NOT looking for Javascript
Because your "widget" is sitting in an iframe, the only way for it to affect its parent is with JavaScript.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Can you refresh an entire page, from within an iframe?

Post by simonmlewis »

Thanks. I think I got it, just the other way around.
Not heard of Firebug, but will look into it.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply