tekkieguru
asked on
Is there any way to use Javascript to do a Ctrl-F5 refresh?
I have a small php file that runs inside of a frame. Is there any way that i can do a CTRL-F5 type of refresh and reload the whole browser window. I've tried parent.location.reload(tru e), location.reload(), and quite a few others. The page doesnt seem to want to redirect. If i do a CTRL-F5 on my keyboard it reloads fine. Any help is much appreciated.
$SiteLink = "/home/wwwnhs/public_html/userfiles/image/";
if (isset($_GET['file']))
{
$sDeleteFileName = $_GET['file'];
$sDeleteFileName = $SiteLink.$sDeleteFileName;
if (file_exists($sDeleteFileName)) {
unlink($sDeleteFileName);
/*********************************
* Need Reload Function HERE!!!!! *
*********************************/
//echo "<br />File ".$sDeleteFileName. " Exists!";
}
else {
echo "<br />File - ".$sDeleteFileName." Does not Exist!";
}
}
else {
echo "<br />File Variable Not Set!!!!";
}
You can't do a Refresh function in PHP because it runs on the server and it's done running by the time you see the page. Does the PHP create a full web page inside the iframe? If it does, you could do a periodic refresh with a 'meta' tag. Then you'd have to rewrite the tag every time with a slightly different query string to make sure it isn't just reloaded from cache.
Opps, seems I didn't read your question correctly. you're in a iframe...
You could output something like this
top.window.location.reload ();
You could output something like this
top.window.location.reload
That needs to be in javascript tags
<script type="text/javascript">
top.window.location.reload ();
</script>
<script type="text/javascript">
top.window.location.reload
</script>
In the frame, do a javascript:
window.parent.location.hre f='http://google.com';
you can do this even in a onclick="" event if you want, or just <script>window.parent.loca tion.href= 'http://google.ro';</script > to refresh as soon as it's loaded
window.parent.location.hre
you can do this even in a onclick="" event if you want, or just <script>window.parent.loca
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
top.location.reload(1); // reload from server
http://php.net/manual/en/function.header.php