On Wednesday, Mar 12, 2003, at 13:22 US/Pacific, Shahar Evron wrote:
hi...[..]
is there a good way to send JavaScript variables to a perl program WITHOUT using a form? (or mybe with a form, but i don't want the program to return anything, and i don't want a popup window to show up...)
I know it sounds wierd, so i'll give an example...
lets say i have a statistics gathering script called stats.pl and it returnes nothing to STDOUT when run, only writes to a data file.
I can tell the user's IP by using $ENV{'REMOTE_ADDR'} etc., but i want to know some more stuff, like the user's screen size or the local time, which i can tell using JavaScript. My problem is sending this data to my perl script. The problem when using a form is that the browser loads a new document for the result, even if it is empty.
If you got my intention, please help...
First off it would be nice if JavaScript had a way to open a socket connection back to the web-server to send a message to it that contained all of the 'query string' information that you would want to pass back to the web-server for 'logging purposes'. But that is not easy and a bit more complicated to try and pull off.
One way to solve your problem is to have a 'prefatory' page that collects the data, and then POST's that back to the web-server before showing the 'real page'.
This way the 'flow' seems 'reasonable' to the user.
You could have one cgi script say
DataCollector.cgi
that contains some java scripting, to get all of the relevant data, but calls
RegularProcess.cgi
which will first off call your stats.pl script with the relevant information, and then return the appropriate web_page to the user.
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]