|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm working on an intranet application. I want to know how can be made that when an user clicks a link to file (mp3) instead of downloading it, to start the viewer for that file (winamp)? If I type the URL (serversharepathfile) in the Internet Explorer 5 address bar it works perfectly, but if I code: window.location.href=URL; the browser pops up the downloading window.
|
|
#2
|
|||
|
|||
|
You could try <a href="file:[fullpath to file]"> or perhaps using <embed> tags?
Please let's know the outcome, since I'm ot in a position to try this right now. Success, Ton [This message has been edited by tvanbart (edited October 12, 2000).] [This message has been edited by tvanbart (edited October 12, 2000).] |
|
#3
|
|||
|
|||
|
You need to use the <EMBED> tag. Also, bear in mind that the browser will probably try to refresh to a page that only has the music player in it, so if you don't want to lose the rest of your HTML, you should put the embed in a separate frame. You can hide the frame, but sometimes audio files require the user to click the 'start' button on the media player to start the sound.
Unfortunately, scripting of sound files in the browser is still about as primitive as it was 4 years ago, unless you use ActiveX, or Java. |
|
#4
|
|||
|
|||
|
Thanx guys. It really works.
|
|
#5
|
|||
|
|||
|
The default control is rather ugly. The easiest way is to pop up a window and retrieve the url by querystring (I use ASP and it's very easy to do it). I will try other ways also to see which is the best (hidden frame, hidden div).
|
|
#6
|
|||
|
|||
|
I found the neatest solution (at least for IE): <script> // file is a preprocessed string "serversharepathfile" function playMusic(file) { document.all.musicplayer.innerHTML = "<embed src=" + file + ">"; document.all.stopmusic.style.display = "block"; } function stopMusic() { document.all.stopmusic.style.display = "none"; document.all.musicplayer.innerHTML = ""; } </script> ... <div id="stopmusic" style="display:none;"> <a href="javascript:stopMusic()">Stop Playing</a></div> <div id="musicplayer" style="display:none;"></div> Thanks a lot for your help! |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > accessing files through links |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|