In tracking users online, in most applications you'd have a connection to the server open, which the system can track to monitor who's online. Without that, HTTP is a connectionless protocol, so you can't really track that. An alternative to the onLoad and onUnload functions is to have registering as online as part of the page loading, and to keep track of when someone was last online - effectively set things up so that if there is no activity from someone in a given period then they're online, and if they 'log out' of the system then it explicitly marks them as offline. That can provide some measure of functionality in itself, but you can set a page to refresh regularly - often a zero size frame - which will then keep someone signed in, and if they close the browser then after a minute or whatever it recognises them as offline. It generates more traffic, but it doesn't open any new windows. David Burton ----- Original Message ----- From: "3dfestival - WebMaster" <thomas@3dfestival.com> To: "zopeQ" <zope@zope.org> Sent: Monday, April 30, 2001 12:14 PM Subject: [Zope] Q: onLoad + onUnload...?
My prob: I want to make a variable in DTML which counts the user online....
I actually did do it, but in a crappy way:
<body onLoad="addUser();" onUnload="subUser();">
and I had made to functions in javscript:
function addUser() { self.open('addU', 'counting users'); }
function subUser() { self.open('subU', 'counting users'); }
and to DTML-methods
===== addU ===== <html><head> <dtml-call "REQUEST.set ('uc, uc+1)"> <script language="javascript"> <!--self.close();--></script> </head><body></body></html> ===== subU: ===== <html><head> <dtml-call "REQUEST.set ('uc, uc-1)"> <script language="javascript"> <!--self.close();--></script> </head><body></body></html> =====
and I added a porperty (integer) called uc...
It worked fine, but it was very irritating for the users that a new window woukd open and then close every time the went from one place to another....
Now to my Q:
Is there some way to do this javascript in DTML or PYTHON....? If so: How...?
( = Stoons = ) - Webmaster @ 3D festival (http://www.3dfestival.com)
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )