same result." />
开发者

audio tag not working in IE9

开发者 https://www.devze.com 2023-04-03 13:28 出处:网络
I\'m experimenting with the audio tag. The file below does work in Google Chrome, but not in IE9. I\'m always getting \"audio tag not supported\". I also tried wav, flac, wma --> same result.

I'm experimenting with the audio tag.

The file below does work in Google Chrome, but not in IE9. I'm always getting "audio tag not supported". I also tried wav, flac, wma --> same result.

I suspect there migh开发者_运维百科t some issue with the compaitibility mode, but I don't find where to change it.

Can anyone help? Kind regards Georg

<html>
  <head>
  </head>
  <body>
    <audio controls="controls" src="c:\concerto.mp3" >
       audio tag not supported.
    </audio>            
  </body>
</html>


Add the HTML5 doctype to the page and it should trigger standards mode in IE9. You should also add a title element to make the document valid:

<!DOCTYPE html>
<html>
  <head>
    <title>Add a title</title>
  </head>
  <body>
    <audio controls="controls" src="c:\concerto.mp3" >
       audio tag not supported.
    </audio>            
  </body>
</html>

If you're still having trouble, try adding this meta tag to the head:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">


If 'audio' is working in chrome, safari, etc. but not in IE, check your meta tags. I had one that referred to IE8 which stopped the 'audio' from functioning. It was quite frustrating until I found the problem at which point the lights went on.


IE plays files in your PC if you give full path as as a URL "file://c:/concert.mp3" or only file name "concert.mp3" if the file is in the same folder as the html file. Firefox also requires full path for files in other folders while Chrome seems to add 'file://' if it is not in the URL. This is a problem if you want to use the to play local files if they are in other folders. The FileAPI does not allow you to find the path of the file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号