Forum Moderators: open
I have no problem writing to a file with ASP, but I don't want to do a redirect to pass variables in a querystring because it would cause an infinite loop. (the way I am set up) But if I could call an ASP function with an #include I have no problem using a querystring.
So is it possible to pass the javascript variables to an include such as:
<script ...>
JSvariable = "some value"
if ...
{
<!--#include file="scripts/write.asp?" & JSvariable-->
}
</script>
Clearly I am not sure about how to do this. Can anyone give me some clues?
The order of processing is such that it wouldn't work the #include is processed first, followed by the ASP and then the client side Javascript.
If you want the output of the Javascript written to a server side file then it can be done using a pop-up or a hidden frame which loads an ASP file.
Anyway...
The text file is on the same server as the site. I have an #include that does my tracking for me, but I want to have a separate log which adware people have installed.
The only script that I have found that determines the existance of adware is in Javascript and outputs the results to the page. I don't mind using a pop-up, I can have it close after it is done, which would be very quick. How could I pass the info to a pop-up?
(I'm not very good at my JavaScript. I know the basics, but it isn't as easy to find help online as it is for VBScript and ASP)
Also, in IE, you can post directly from a client side javascript script to a web server, but I think this functionality is limited to IE. In other words you would post data to myloggingpage.asp, which would simply do the logging, transparent to the client.
HTH
Ross
function Popup(URL) {
day = new Date();
id = day.getTime();
window.name="main";
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=300');");
eval("page" + id + ".moveTo(0,0);");
eval("page" + id + ".blur()");
window.focus();
}
Where the URL is "my-file.asp?var=javascriptvariablevalue"
Then in my-file.asp
ASP Write File Code
<head></head>
<body onload="self.close();"></body>
<script language="JavaScript" type="text/JavaScript">
var SomeVar='Hi There';
document.write('<script language="JavaScript" type="text/JavaScript" src="dynamicpage.php?var=' + SomeVar + '"><\/script>');
</script>
Now in dynamicpage.php:
alert('<?=$_GET["var"]?>');
// You could just as easily write this var to a text file.
Kinda convoluted...probably regret posting it..but it looked kinda kooky and fun.
Bill
Kinda convoluted...
Not really, that's what I was looking for, but from what I have read online I'm not sure it would work.
I'll try both and see what works. I'm just afraid that the pop-up blockers will defeat the pop-up, especially since I am trying to log visits from software that serves pop-ups. And if someone does not know that the software is on their machine, they are probably using a blocker to control it.