|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am trying to capture user info browsing my site and save it to a text file on my server.
ASP does not seem to provide all the user info i need (resolution etc) So i am getting these through java. I am using the following java script which is capturing user info correctly. <script type="text/javascript"> var info = "BROWSER: " + navigator.appName + " BROWSERVERSION: " + navigator.appVersion + " CODE: " + navigator.appCodeName + " PLATFORM: " + navigator.platform + " REFERRER: " + document.referrer + " SCREEN RESOLUTION: " + screen.width + "*" + screen.height + " AVAILABLE VIEW AREA: " + window.screen.availWidth + "*" + window.screen.availHeight + " COLOR DEPTH: " + window.screen.colorDepth + " IP: " + location.hostaddress Then i am using asp to write to a text file also working fine (with an asp defined variable that is.) <% Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("logfile.txt", ForAppending, True) f.Write Contents f.Close set f = nothing set fso = nothing %> </script> The problem is how to pass this information captured with java to asp. The following between the two scripts is not working. What must i do? <%Contents = info%> |
|
#2
|
||||
|
||||
|
1. Java != javascript, for future reference
2. Javascript is a client-side language, ASP is server-side. The two can't interact. By the time your javascript is up and going, the asp code has already been processed on the server, and is finished. If you desperately need to communicate between the two, both can set and read cookies, so you could use that, or use javascript to send some GET variables to an asp script. However, you can get at least a good portion of what you're looking for with just asp. http://abstractvb.com/code.asp?F=5 has some code to get things like the referrer, and browser information (at least for .net). HTH |
|
#3
|
||||
|
||||
|
What you can do is render the javascript using ASP response.write's
Response.Write "<script>Alert('" & someASPVariable & "')</script>" etc I use these quite a lot to alert ACTUAL SQL statements before I actually execute them. Can be pretty useful. Matt |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Passing java variables to asp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|