Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Is there any way to use Javascript to do a Ctrl-F5 refresh?

Posted on 2010-08-22
7
Medium Priority
?
3,573 Views
Last Modified: 2012-05-10
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(true), 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!!!!";
}

Open in new window

0
Comment
Question by:tekkieguru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 9

Expert Comment

by:Snarfles
ID: 33498259
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 33498322
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.
0
 
LVL 9

Expert Comment

by:Snarfles
ID: 33498398
Opps, seems I didn't read your question correctly. you're in a  iframe...

You could output something like this

top.window.location.reload();
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 9

Expert Comment

by:Snarfles
ID: 33498400
That needs to be in javascript tags

<script type="text/javascript">
top.window.location.reload();
</script>
0
 
LVL 6

Expert Comment

by:hexer4u
ID: 33499427
In the frame, do a javascript:

window.parent.location.href='http://google.com';

you can do this even in a onclick="" event if you want, or just <script>window.parent.location.href='http://google.ro';</script> to refresh as soon as it's loaded
0
 
LVL 6

Accepted Solution

by:
hexer4u earned 2000 total points
ID: 33499437
forgot this.

replace
/*********************************
* Need Reload Function HERE!!!!! *
*********************************/

with
echo "
<script type='text/javascript'>
window.parent.location.href='http://THE_URL_YOU_WANT';
</script>
";

and the page will refresh automatically.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33500296
top.location.reload(1); // reload from server
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

721 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