810311
October 15, 2014, 3:05am
1
Good day,
I am using HTML 5 element to play audio on a webpage. All browsers support .wav files, however, IE supports only mp3. Is it possible to use Javascript to load mp3 and play it when IE is detected?
Unfortunately conditional comments are no longer supported starting from IE 10.
I am using this code <audio id="sound" src="file.wav" preload="auto" autoplay controls></audio>
in case of IE it should be
I am using this code <audio id="sound" src="file.mp3" preload="auto" autoplay controls></audio>
<audio id="sound" preload="auto" autoplay controls>
<source src="file.wav" type="audio/wav" />
<source src="file.mp3" type="audio/mp3" />
</audio>
Should play the wav in browsers that understand how to play it and should then play the mp3 in browsers that can’t play wav but can play mp3.
3 Likes
Just in case the member copies this, you should be aware OP that after "audio/mp3 there is no ending quotation " . Make sure you add that if you use his script.
810311
October 16, 2014, 3:07am
5
Thanks,felgall. It’s working now.Sorry for posting in the wrong forum guys - has nothing to do with Javascript.