I found a script called BatmoAudiopop.js which opens a pop-up browser window with an audio player when a link is clicked. Basically, it sets the right mime-type depending on the operating system and audio file type, then opens a window with the audio file (passed as a parameter) in an object with a
Expand|Select|Wrap|Line Numbers
- param name=src
Expand|Select|Wrap|Line Numbers
- embed
Expand|Select|Wrap|Line Numbers
- <a href="audiofile.mp3" target="_blank" onclick="javascript:BatmoAudioPop('description',this.href,'1'); return false">
I found another server-side script called load.cgi that opens a text file, finds the passed url name of the file to be downloaded in it, updates the count associated with it (or, if not there, creates a new entry with the count set to 1) then redirects the page with
Expand|Select|Wrap|Line Numbers
- print: "Location: $link\n\n";
Expand|Select|Wrap|Line Numbers
- <a href="cgi-bin/load.cgi?downloadfile.whatever">
What I'm trying to do is to combine the two scripts (BatmoAudiopop.js and load.cgi) so that when someone clicks on 'PLAY', the count gets updated at the server and the pop-up player opens. (Note - I don't care about the 'calling' page getting its count updated at this point - just the next time it is viewed.)
If I just alter the javascript call to
Expand|Select|Wrap|Line Numbers
- <a href="cgi-bin/load.cgi?audiofile.mp3" target="_blank" onclick=javascript etc....
I've examined load.cgi and can't see how the search/update loop can be going wrong - I can only surmise that the script is being called three times.
I've tried altering the javascript to remove the
Expand|Select|Wrap|Line Numbers
- cgi-bin/load.cgi?
I don't really understand the relationship between the href parameter and what happens with onclick.
I've spent ages searching the Internet to see if anyone else has tried to do a similar thing and to try to glean more understanding, with no luck. The cgi script runs on my ISP's server; I don't really want to set up a web server on my machine and spend hours experimenting - I want to get on with editing my audio play!
Can anyone explain why the count should be getting updated by 3? And how I can achieve the result I want? (I suppose I could just divide the count by 3 before displaying it, but that's not very elegant.)
I would have included the entire scripts but, since they are shareware, I'm not sure about the etiquette of doing that - I don't want to offend anyone.