Page 1 of 1

Blank Screen query

Posted: Tue Nov 22, 2011 4:12 am
by IGGt
I have a page I created, which is basically a wallboard. It refreshes every x seconds (normally 60), which in turn forces it to run a load of MySQL queries, which then populates the page.
Generally it works really well, and if there is any errors, it is caught and displayed neatly etc.

However, I have noticed that (usually, but not always) overnight, at some point it just seems to stop. I come in, in the morning, and it is just a blank screen. I have to manually refresh the browser for it to start again.

I know it hasn't been running, as one of the things it does is check the number of updates in the past 60 seconds, and displays the last 10, and it always has a very low number for the last one, suggesting it last ran overnight at some point.

The server it runs on is fine, the PC it is displayed on is fine as it also runs 24/7 with other apps.

n.b the entire page is in HTML/PHP (no javascript - not my strong point).

I'm sorry if this is a bit vague, but was wondering if anyone could suggest reasons why this might happen, or things I can do to try and stop it.

Re: Blank Screen query

Posted: Tue Nov 22, 2011 4:40 am
by maxx99
How do you force refresh every 60s?

Re: Blank Screen query

Posted: Tue Nov 22, 2011 5:00 am
by IGGt
I set the refresh time on the config page which is then stored to the database for the long term, and held in a $_SESSION variable for the short term (30 page refreshes), after which it checks the database again for any changes.

I then check to see if it is 0 (Manual Refresh Only) or if it is a number (60, 120, 300) and set a $RefreshTime variable accordingly.

Code: Select all

<?php
...

//Page Refresh
$refresh = $_SESSION['pageRefresh'];
	if ($refresh == 0) {
		$RefreshTime = "<!--<meta http-equiv=\"refresh\" content=\"$refresh\">-->\n";
	} else {
		$RefreshTime = "<meta http-equiv=\"refresh\" content=\"$refresh\">\n";
	};
...

?>		

<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">-->
<head>
	...
	<?php print $RefreshTime; ?> 	
	...
</head>
	...


Re: Blank Screen query

Posted: Tue Nov 22, 2011 5:11 am
by maxx99
I've never liked meta-refresh, i had similar problems.

This one should do the trick:

Code: Select all

<script language="javascript" type="text/javascript">setTimeout("location.reload();",1000);</script>
Where 1000 is time in ms.

Or if thats possible for you, you can use some autorefresh plugins for Firefox or Opera (there's already an option to do that).

Re: Blank Screen query

Posted: Tue Nov 22, 2011 5:23 am
by IGGt
Cheers, I'll give the javascript a go.

Re: Blank Screen query

Posted: Tue Nov 22, 2011 5:51 am
by maxx99
Let us know how does it work :)

Re: Blank Screen query

Posted: Thu Nov 24, 2011 3:03 am
by IGGt
Hi There, I came in this morning, and although the screen wasn't blank, it had simply stopped refreshing, so a partial success (Although in some ways the blank screen was better, as we at least knew that it had stopped).

Re: Blank Screen query

Posted: Thu Nov 24, 2011 3:17 am
by IGGt
I've just spotted the (probable) reason. When the page went to refresh after 60 seconds it came up with the message:

"To display this page, Firefox must send information that will repeat any such action (such as a search or order confirmation) that was performed earlier. Resend / Cancel"

This was on Firefox 6, on my test machine (firefox 8 / Chrome) it was fine.

I have reverted back to the meta-refresh for the minute.

Re: Blank Screen query

Posted: Mon Nov 28, 2011 3:04 am
by IGGt
I left it running on my test PC over the weekend, which didn't suffer the problem described above, and unfortunately it stopped refreshing. So there must be something else in my code causing the refresh problem.
Interestingly, I set up an iFrame which was set to refresh, but at a longer interval, with the intention that if the main page stopped refreshing, maybe the iFrame would continue, and give an alert. It didn't work, as it stopped along with everything else.