Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Automatic Refresh of Web Reservations Page

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#WebRefresh or http://www.notesninjas.com/A555F9/nn.nsf/ByAlias/WebRefresh


A customer has a web page that shows the room reservations on a LCD screen near the meeting room suite. The page refreshes every 5 minutes using the META Refresh tag, to show who is in which room, and which rooms are free. Nice. Problem: If the page fails to load, due to the server being down for backup or the network is down for service in the weekend or evening the page will not load and will never load.





The page fails to load and creates an HTTP error. The error page cannot be trapped easily, if at all.

This means the IT department have to go and rest all the machines across the site, the application is used in three different buildings and could be rolled out to other sites...

Solution?

The solution I came up with was to have a backup refresh mechanism that relied on javascript not the META-refresh mechanism.

I created a frameset of two frames with the top frame 0 pixels high. The second frame is called "Main".

The code in the top frameset was:

<!-- Auto Load DispPanel Form after 5 mins then every 20 minutes-->

<!-- See http://www.notesninjas.com/A555F9/nn.nsf/ByAlias/WebRefresh for latest ver -->
<script>
<!--
setTimeout('refresh()', 5000);
function refresh() {
parent.frames['Main'].location.replace('http://server/db.nsf/FormToRefresh?OpenForm');
setTimeout('refresh()', 1200000);
}
-->
</script>

This was put on a page and was marked as Pass-Thru HTML.

The times are in milliseconds, so 1000 is 1 second, 1200000 is 20 minutes.

The original form was then set to always load in this frameset.

NB: This works and so I have left it, because if it works leave it alone, but...

After reading up on setTimeout and setInterval I would in the future rewrite this using setInterval, because SetTimeout uses recursion and eventually the browser will get a stack overload and then will "panic".

I am not sure how long it would take to get a stack overload, but if it will overload in 3000 (probably a lot more) calls, and I call it every 20mins then that is 1000 hours which is over 40 days, which is more than enough I think.

SetInterval should never get a stack overload, and should be used. I am sure I will rewrite it one day.

See here for more details:

http://www.webmasterworld.com/forum91/189.htm
http://javascript.about.com/library/blstvsi.htm

 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Beginning Java Web Services by Andre Tost, Henry Andre Bequet, Meeraj Kunnumpurath, Sean Rhody
Web services are no longer a nascent technology in the programming industry; every major software vendor is rolling out web services-related APIs and products. Today Java developers are successfully adopting web services as the latest technology in application development in order to enable...
See at: Amazon.co.uk | Amazon.com |