![]() |
IOBit Software
|
|
|
||||||
| Programming Place to discuss programming including HTML, Java, C++, MySQL and others. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Hi,
This may be a stupid question, but it is possible to create a webpage that has a real time hit counter, that does not need the client side browser to hit refresh to have the hit counter update. For example, we want to have it show the changes in a steady stream to the client without them needing to refresh? Thanks very much! Parsley |
| Sponsored links |
|
|
|
#2
|
||||
|
||||
|
Without creating an applet to do it, I don't think so. The hit counter is generally a server-side object. The client can't access it without requesting data from the server, so I don't see anyway to make JavaScript do it.
The easiest method off the top of my head would be to write a Java applet that would open a connection to your server and receive updates. That wouldn't be a very efficient task, though.
__________________
"Those who will not reason are bigots; those who cannot are fools; and those who dare not are slaves." -- Lord Byron Windows 2k/XP Stop Error and Bug Check Codes: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevTest_g/hh/DevTest_g/BCIntro_ea8b9fd0-2d81-4a04-a7ed-c1c6a80bd501.xml.asp |
|
#3
|
||||
|
||||
|
it's possible. Just not over the HTTP layer. It is possible to write a remote agent in something like Java, which downloaded to the client's machine and did the required functions. Either that, or you could insert a refresh META command to refresh, eg a frame... but that's not what you want. It's not easy, and not possible in JS, HTML or a backend language.
PS - this would have been better in the "programming" section.
__________________
Pop Quiz: Which numbered statement (1 or 2) is the "better", and why? and :: Bool -> Bool -> Bool (1) i) and ┴ False = False (1) ii) and False ┴ = False (2) i) and False ┴ = False and True True = True |
|
#4
|
||||
|
||||
|
I think ChViRuS is on to something.
Ok, use javascript to open a small window (say 100x100) to a new page. Like so: Code:
<body onLoad="javascript:void(window.open(URL, name [, features]));"> This page is a .cgi page whose sole content is the Perl hit counter. Instead of a <META> tag refresh, try sending a content header refresh (which are more widely supported, IMX): In Perl: Code:
#!/usr/bin/perl print "Content-type:text/html\n"; print "Refresh:X; URL=http://www.site.com/thisDocument.cgi\n\n"; print "<html>"; # Here is you code for the actual web page hit counter Alternately, you could use the setTimeout() JavaScript command on your main page to force a refresh by sending a document.open() command to a named small window.
__________________
"Those who will not reason are bigots; those who cannot are fools; and those who dare not are slaves." -- Lord Byron Windows 2k/XP Stop Error and Bug Check Codes: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevTest_g/hh/DevTest_g/BCIntro_ea8b9fd0-2d81-4a04-a7ed-c1c6a80bd501.xml.asp |
|
#5
|
||||
|
||||
|
Actually, you could probably use an <IFRAME> (inline frame) instead of a new window. Only problem there is that Mozilla and Opera don't support it well. But if you don't care about 5% of the INternet, you're good to go.
__________________
"Those who will not reason are bigots; those who cannot are fools; and those who dare not are slaves." -- Lord Byron Windows 2k/XP Stop Error and Bug Check Codes: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevTest_g/hh/DevTest_g/BCIntro_ea8b9fd0-2d81-4a04-a7ed-c1c6a80bd501.xml.asp |
| Sponsored links |
|
|
|
#6
|
||||
|
||||
|
to get around that you could have the script check the user agent string to find out if its Mozilla or Opera, and if it isnt, make the IFrame, but if it is open the window.
__________________
(¯`·._.·[ Gø|ÐFï§h ]·._.·´¯) Folding@Geeks, TEAM 12072 http://www.majorgeeks.com/page.php?id=9 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Web Design Help | Adrynalyne | Programming | 12 | 01-14-04 10:28 |