I would be really glad if someone could help me with this little problem.
I have a site were visitors can download songs that I have made and I want to count how many times every song has been downloaded. I thought that I could do something like this...
I have a page with links to my songs. When a visitor clicks on a link they will be redirected to a page lets say bla.jsp?id=1
On bla.jsp I do a request.getParameter("id") and make a connection to a database were all my "songs" (the name of the songs) are stored with the same "id" as on the page.... Now I have solved the "count problem"
Now I want from bla.jsp open a new little window, above my bla.jsp, which will download current song. Lets say that my track is called "hello.mp3" with id=1. My songs are stored on my webbserver and not in a database in a catalogu called "musik" (musik/hello.mp3).
Working web site is not the one that looks the same in a few graphical browsers, but the one that adequately delivers its content to any device accessing it.
Thanks for your answer Vladdy... you are right, you have to excuse my lack of knowledge but....
How do I redirect....will that create a new window in that frame which the link was clicked or will it just create a "downloadwindow" (that would be the best).
If the file is sent with MIME type that can not be displayed by browser, the Download/Execute window will show. If you check the "Download Evaluation Code" functionality on my site - that is what happening, when the user submits the form, the request is logged and then redirection is done.
I'm not sure how to do the redirection in jsp
Working web site is not the one that looks the same in a few graphical browsers, but the one that adequately delivers its content to any device accessing it.
Ok, I dont have a clue if the file is sent with MIME, the mp3 file is on a webserver. There is no forms in this downloadprocess.
I thought that because that the jsp-page is created on the serverside and is send back to the client I could have a <body onload="viewWindow(id)> where id is my songindex.
Then in my vieWindow(id) I check index and create a new little downloadwindow that download correct song.
But I really dont know how to create that kind of window that downloads a file automaticly.
server.script :
// Increment the counter
// redirect to GET['file']
I do not know jsp so I can not help you with implementation, but I do know this approach works just fine with ASP and PHP - it does not matter what server side language is - you are relying on HTTP protocol for redirection.
Working web site is not the one that looks the same in a few graphical browsers, but the one that adequately delivers its content to any device accessing it.
Working web site is not the one that looks the same in a few graphical browsers, but the one that adequately delivers its content to any device accessing it.
Moved to the "other" section as this isn't JavaScript-related. As for sending HTTP headers, you might consider looking into the response.addHeader method.
Bookmarks