audio tag not working in IE9

℡╲_俬逩灬. 提交于 2019-12-20 15:11:40

问题


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 might 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>

回答1:


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">



回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/7358689/audio-tag-not-working-in-ie9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!