MajorGeeks Support Forums

Go Back   MajorGeeks Support Forums > ----------= PC, Desktop and Laptop Support =---------- > Software
Register FAQ Members List Calendar Casino Mark Forums Read

Software Software such as operating systems like Windows XP, Windows Vista, Windows 7 etc., or specific programs.


Reply
 
Thread Tools Display Modes
  #1  
Old 06-20-03, 18:21
parsley parsley is offline
Private E-2
 
Join Date: Sep 2002
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy web hit counter

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
Reply With Quote
Sponsored links
  #2  
Old 06-20-03, 18:38
da chicken's Avatar
da chicken da chicken is offline
Major Geek
 
Join Date: Apr 2003
Location: Tucson, AZ
Posts: 1,466
Thanks: 0
Thanked 9 Times in 9 Posts
Default

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
Reply With Quote
  #3  
Old 06-20-03, 18:39
ChViRuS's Avatar
ChViRuS ChViRuS is offline
Private First Class
 
Join Date: Feb 2002
Location: OMNIPRESENT
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #4  
Old 06-20-03, 19:12
da chicken's Avatar
da chicken da chicken is offline
Major Geek
 
Join Date: Apr 2003
Location: Tucson, AZ
Posts: 1,466
Thanks: 0
Thanked 9 Times in 9 Posts
Default

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
Where X Is the number of seconds between refreshes. Don't set it too low (no less than 3, I recommend 5) because you run the risk of sending a new request before the current one is completed. That will DOS your server eventually.

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
Reply With Quote
  #5  
Old 06-20-03, 22:40
da chicken's Avatar
da chicken da chicken is offline
Major Geek
 
Join Date: Apr 2003
Location: Tucson, AZ
Posts: 1,466
Thanks: 0
Thanked 9 Times in 9 Posts
Default

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
Reply With Quote
Sponsored links
  #6  
Old 06-22-03, 04:28
goldfish's Avatar
goldfish goldfish is offline
Lt. Sushi.DC
 
Join Date: Jun 2002
Location: UK
Posts: 7,137
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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|Fh ]._.) Folding@Geeks, TEAM 12072 http://www.majorgeeks.com/page.php?id=9
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Design Help Adrynalyne Software 12 01-14-04 10:28


All times are GMT -5. The time now is 04:04.

MajorGeeks.Com Menu

MajorGeeks.Com \ All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ NEW! PC Games \ System Tools \ Macintosh \ Demonews.Com \ Top Downloads

MajorGeeks.Com \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds


Powered by vBulletin® Version 3.8.4
Copyright © 2009 vBulletin Solutions, Inc. All rights reserved.
Ad Management by RedTyger