不同浏览器中的网站代码问题

时间:2015-07-28 14:50:50

标签: html5 browser

我有这个代码适用于Firefox,但是当我尝试让IE播放音频文件时出现错误(播放被中止)

我不想仅为一个浏览器优化我的网站,所以我想知道我做错了什么。

<html>
<HEAD>
<TITLE>...</TITLE>
</HEAD>
<BODY>
<H1 ALIGN="CENTER">...</H1>
<P ALIGN="CENTER"> <IMG SRC="../picture/1.jpg"></P>
<P ALIGN="CENTER"> ...</P>
<P ALIGN="CENTER"> <audio controls><source src="../audio/1.mp3" type="audio/mpeg"></audio></P>
<P ALIGN="CENTER"> ...</P>
<P ALIGN="CENTER"> <audio controls><source src="../audio/2.mp3" type="audio/mpeg"></audio></P>
<P ALIGN="CENTER"> ...</P>
<P ALIGN="CENTER"> <audio controls><source src="../audio/3.mp3" type="audio/mpeg"></audio></P>
<P ALIGN="CENTER"> ...</P>
<P ALIGN="CENTER"> <audio controls><source src="../audio/4.mp3" type="audio/mpeg"></audio></P>
</BODY>
</html>

我已经编辑了标题。为什么IE限制脚本或活动X控件?

ERROR 1 ERROR 2

1 个答案:

答案 0 :(得分:1)

It is a safety feature. As you are running the file locally (not on a server or trusted site), Internet Explorer blocks the ActiveX controls and scripts because it considers that they may unsafe or harmful to your computer. I guess the idea is that IE doesn't know if you developed that page yourself, or if you downloaded it from somewhere potentially dangerous.

In SuperUser there is a possible solution for this. It is from 2010, but it sill applies to IE11:

  1. Open IE
  2. Go to tools > Internet options
  3. Click on the advanced tab
  4. Check the box "Allow active content to run in files on My Computer*"
  5. Restart the computer

Internet options with mandatory handfree circle to highlight option