Auto Refresh Script


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Auto Refresh Script

  1. #1
    Join Date
    Jun 2004
    Posts
    12

    Auto Refresh Script

    Hello everyone. Have a script question for you.

    Ok, I want to make a script that will refresh a browser window periodically. Can I do this using Java? And if so, could someone give me a short code example?

    Thanks in advance,
    shimano55

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    I would have used JavaScript for this. There is a
    method in JavaScript setInterval that allows for
    invoking a function at specific time intervals, and this could be a JavaScript function that reloaded the current URL.

    If you were to use Java for this it would be much slower
    to load for the client, but the strategy could be one
    of two:

    1:
    You use a frameSet and place the applet in another
    frame than the reloadPage. In the start() method of
    the applet you start a thread that sleeps for the
    specified reloadInterval and reloads the page when
    it wakes up. (see the getAppletContext() method for
    details). After the reload the thread the goes to
    sleep again, ... and keeps on doing that

    2:
    You have the applet embedded in the reloadPage,
    do the same as above, except that the 'going to sleep
    again' is left out as the reload will reinvoke the start() method.

    For both cases you must implement the applets stop()
    method, wherein you terminate the thread.


    The frameSet/same page strategy also appiles to the
    JavaScript method.
    eschew obfuscation

  3. #3
    Join Date
    Jan 2005
    Posts
    15
    If it's complete refresh of the browser window, why not just use HTML directly? E.g.,

    <html
    <head>
    <meta http-equiv="refresh" content="600">
    </head>
    <body>
    Refresh
    </body>
    </html>

    See http://webdesign.about.com/cs/metatags/a/aa080300a.htm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center