I am trying to use onclick to call a function and play a file however the file does not play in ie11, plays fine in Chrome and Firefox.
Here is the code
function play1(){ var audio1 = document.getElementById("audio1"); audio1.play(); } function play2(){ var audio2 = document.getElementById("audio2"); audio2.play(); }
<div class="audiobuttons"><a class="btn btn-primary" onclick="play1()">Play Example <i class="icon-white icon-play"></i></a></div><br /><audio id="audio1" src="training/example7.wav" ></audio></div> <div class="audiobuttons"><a class="btn btn-primary" onclick="play2()">Play Example <i class="icon-white icon-play"></i></a></div><br /><audio id="audio2" src="training/example8.wav" ></audio></div>
As @adeneo correctly mentions, IE11 does not support WAV files. I had this issue and found that a simple file conversion to MP3 files solved my issues. It has much greater support.
For more info, see here: https://caniuse.com/#search=mp3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.