I'm a complete javascript novice, but I have pieced together some basic javascript that extracts the source parameters from a url when the page is loaded (using body onload=). For example:
In other words, my browser pop's up as usual asking whether to open or save the file, but the .exe identifier is gone. Saving the file results in a document with no file extension.
For now, I'm just using a basic link with .exe files <a href="test.exe">, but I would like to append the calling parameters to this URL too so I can track them in my access logs.
Strange, your full example worked fine for me. However, if I change the fixed source variable to the code I use to get the source from the URL, it no longer works (but it does work fine with my original code).
function getSource(){
source = document.URL.substring(is_input+1, document.URL.length);
return source
}
Alas! I cannot directly solve the problem with .exe files. Since they were never intended to accept a query/search string, this is probably why it causes a problem to have one. There is an alternative, but it would mean changing the whole method by which you are tracking this information.
> I cannot directly solve the problem with .exe files
Not a problem. I appreciate the input you have given already.
> There is an alternative, but it would mean changing the whole
> method by which you are tracking this information.
What alternative are you thinking of?
While we're talking javascript and exe files, do you know if there's a way to rename the exe file (or select alternate exe files) based on the URL parameters?
The alternative would solve the problem of .exe files and the renaming of files. Server-side code has the ability to tell the browser (not just IE) to open the download manager dialog ("Save As" dialog) and to specify the default file name to use. The file itself is sent as an HTTP Attachment -- this is what tells the browser to open the download manager dialog. As part of this attachment information, you can also specify the desired file name. Thus, the server-side code can keep track of the files it sends to the browser for download. A link like the following is how you could start this process:
The ASP document would know where to find the specified file and could download it with whatever alternative name it chose. This is also a good way to prevent your visitors from knowing where the file is found. This prevents them from bookmarking the location and easily retrieving the file again later. It forces them to go through your established process to obtain the file.
Hmm... I hadn't thought about an ASP page just for downloads. It's probably a little too involved for my current needs, but I'll keep it in mind for the future.
Not just ASP -- in case you misunderstood. PHP can do it, too. And both only require about 25-50 lines of code (depending upon how you wish to store the tracking information.
I dont know if it helps, the issue with the .exe appending thingy...
I used to have a web server set up to use a free cgi program, your request for the somefilename.exe?myAppendedText=someValue could be invoking a cgi program to find the value string ?myAppendedText=someValue and act on its value.
Bookmarks