-
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
-
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
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks