HTML5 Audio not working in ie7 or ie8
html, internet-explorer, javascript
Solution
Many older browsers including IE7/8 do not (fully) support HTML 5.
You can use Modernizr to detect whether the current browser supports audio.
There are polyfills for many features including audio that can add support for missing features
https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills
(scroll down to the Audio section for options)
The polyfills work on a wide range of supported browsers and browser versions.
Problem
When testing in IE7/8 my script crashes and I get this error... SCRIPT438: Object doesn't support property or method 'play' I'm using the HTML5 audio tag to embed and play audio on my webpage. ``` <div id="auido-container"> <audio id="music" loop="loop"> <source src="audio/holiday-for-mr-anderson-60secs.mp3"></source> <source src="audio/holiday-for-mr-anderson-60secs.ogg"></source> Your browser isn't invited for super fun audio time. </audio> <audio id="sound"> <source src="audio/pop.mp3"></source> <source src="audio/pop.ogg"></source> Your browser isn't invited for super fun audio time. </audio> </div> ``` My JS looks like this: ``` start.click(function(){ audio.play(); }); ``` I've included this in my header: ``` <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> ``` Does anyone know of any solutions or fixes?