Unfortunately, it is not possible to write such a program in Java without the co-operation of a server, somewhere to centrally record the current value of the counter.
Happily there are people who will provide you with free hit counters and free use of their server, usually in exchange for some advertising on the counter.
A source of free counters is TheCounter.com. They require 24 lines! of Javascript that confounds the Vslick beautifier. The odd thing is, to me, it looks as if the JavaScript is unnecessary. By default, the counters look like this:
Another source of free counters is Vendio.com née honesty.com, née andale.com
Try the WebCounter people. They also issue free counters that by default look like this:
Commercial hit counters generally give faster response than free ones. Before you sign up see if you can find some of that vendor’s hit counters on other people’s sites and see how responsive they are. A sluggish hit counter can be very annoying to your visitors.
Some hit counters let you substitute your own set of ten gifs for the digits 0 to 9 to create the counter. With search engines, you can find hundreds of sets of free gifs to use.
There is not much point combing the web for hit counter software to run on your server. Most ISPs won’t let you run it. They may have some software they have tested they will let you run, usually for a fee. The hit counters on my pages are handled by Novell’s SSI and are sent as ASCII text. Every ISP will have his own preferred way of doing them, usually with CGI.
In theory, you could create a Java Applet to display a hit counter. The central site could send the value of the count over in compact binary. However, this would be slower than using CGI since tche browser would need to download the Java Applet containing contain code and a complete set of *.gifs for all the digits. Further the browser user would need to load the Java interpreter. This would take considerably more time than just sending the count or the gifs needed to display the current count. The other problem is the count would not work for people who did not have Java installed or if their Java did not work, or if the Java Plug-In 1.2 had sabotaged the 1.1 version. If there were some way of caching Applets, this technique could be very fast. Perhaps we will see them in future, using smoooth animations or other gimickry.
There are several possible ways of computing hits.
You can display the value of the count for a file with with:
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.16] | The information on this page is for non-military use only. | ||
| You are visitor number 66,328. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/Mindprod website mirror) | ||
| http://mindprod.com/jgloss/hitcounter.html | J:\mindprod\jgloss\hitcounter.html | ||