March 4th, 2005

mini me + poo

Stopping web page refreshes in the middle of form-filing

We have a spiffy new intranet at work, otherwise known as hosting a minimal webserver on my PC with a PHP-based message board for internal notices.

Because I just know that half the staff aren't going to refresh their browsers to see if there are any new messages, I wanted the page to refresh automatically every so often.

The obvious way to do this is with <meta http-equiv="refresh" content="1800;URL=mboard.php"> in the head of the page - every 30 minutes this will reload itself.

But what if they're editing a new post at the time? Being cheap and cheerful, this script has the new post form at the bottom of the page that's being refreshed.

With Firefox, this doesn't matter as it will happily refill all the fields. But - as ever - Internet Explorer isn't that nice and blanks the lot.

Two of us have Firefox, everyone else is... well, they don't. And they would complain if this ever happened to them.

So, with a little bit of browsing, it's now has

<head>
<!-- blah blah blah, title and stuff -->
<script language="JavaScript" type="text/javascript">
<!-- reload page every fifteen minutes (reset if start entering a new post)
refreshit = setInterval("window.location.reload( true );", 15*60*1000);
//-->
</script>
</head>


and, in the first box of the 'start new thread' form...

<b>Name:</b><br><input type=text name="name" size=30 maxlength=30 onFocus="clearInterval(refreshit);">

i.e. if the box is selected, stop the setInterval function.

Is there an even easier way? Have I missed something horrible? It looks to work - it assumes you've got a JavaScript 1.2 or better browser, but...
mini me + poo

I was browsing Amazon and...

£1.81 for the 'best of' Fluke triple CD set?!? I've held off buying this, because I have most of their albums and singles already, but at this price, I leapt for the 'buy now' button.

Clearly, they have more than one copy, because it's still available.

It's worth this for one track alone (Atom Bomb mix 4 - as used on some Playstation game or other). If you buy it and don't like it, give it to me, and I'll give you your £1.81 back...
  • Current Mood
    ecstatic ecstatic