Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i made an audio(html5) with jquery on runtime and it worked
on chrome but not IE10

here's the code:

C#
$(a).hover(function(){
var audio = $('<audio>', {
            autoPlay : 'autoplay',
            controls : 'controls'
        });
        var fileFormat = "mp3";
        var canPlayMP3 = (typeof audio.canPlayType === "function" && audio.canPlayType("audio/mpeg") !== "");
        if (!canPlayMP3) {
            fileFormat = "ogg";
        }
        if(fileFormat == "mp3"){
            addSource(audio, 'audio/ding.mp3');
        }
        else{
            addSource(audio, 'audio/ding.ogg');
        }
});



how to create an html5 audio tag on mouse hover dynamically
that plays on every browser?
Posted
Updated 15-Oct-13 2:05am
v2
Comments
bjdestiny 15-Oct-13 8:16am    
have tried browser compatibility code??? specially for internet explorer.
Moosavi S.M. 15-Oct-13 8:26am    
i'm new in cross-browser,
what does that mean to check compatibility code?
Moosavi S.M. 15-Oct-13 8:35am    
i tried but it didn't worked!

1 solution

Put this below mentioned code below your title tag in header of your page then check.

<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900