How to automatically refresh a remote file?

We have a process that every minute creates a HTML file and uploads it via FTP to a server. I need to create a page that will display this file and refresh automatically.

Simples I thought - have an IFRAME and use javascript to reload the content. Which works for most of the time, but some time there’ll be a page not found error.

I’m guessing that the problem arises when my page tries to read the file at the same instant that a new version is being uploaded.

This musr be a common problem, but for the life of me I can’t figure out how to get around it. What have other people done?

Due to restrictions on the system I can’t change the format of the uploaded file, and I’m limited to javascript at the most.

This could be done much cleaner with AJAX. Instead of using an IFRAME, you can have javascript call the server for the content, check the data that’s returned, if it’s correct it can inject that content onto the page and if not it can retry until it succeeds. At that point, just have it poll the server once a minute.

Check out the Sitepoint article on Ajax with Jquery to see how this can be done. Once you’re familiar with jQuery’s Ajax functions, this will be a very simple task.
jQuery’s API docs should help you with this too. For simplicity’s sake, take a look at jQuery.get(): http://api.jquery.com/jQuery.get/