Microsoft Edge浏览器嵌入音频显示动态更新图标

时间:2017-02-15 11:17:45

标签: javascript asp.net microsoft-edge

我使用此功能播放声音

var soundObject = null;
function PlaySound() {

    if (soundObject != null) {
        document.body.removeChild(soundObject);
        soundObject.removed = true;
        soundObject = null;
    }
    soundObject = document.createElement("embed");
    //soundObject.setAttribute("src", "../Sounds/beep-01a1.wav");
    soundObject.setAttribute("src", "../Sounds/Small Blink.mp3");

    soundObject.setAttribute("hidden", true);
    soundObject.setAttribute("autostart", true);
    document.body.appendChild(soundObject);
    // alert('hii sound');
}

它可以在所有浏览器中正常工作,而不是Microsoft Edge浏览器,它在浏览器中显示蜂鸣器图标enter image description here

任何帮助都很明显,谢谢。

1 个答案:

答案 0 :(得分:1)

Edge浏览器似乎忽略了"隐藏"属性。试试这个:

soundObject.setAttribute("style", "display:none");