<audio id="message_notification" preload="auto">
<source src="http://domain/sounds/message_notification.mp3" type="audio/mpeg">
<source src="http://domain/sounds/message_notification.ogg" type="audio/ogg">
<source src="http://domain/sounds/message_notification.aac" type="audio/aac">
</audio>
...
function verifyMessages(){
$.ajax({
type:"POST",
ifModified: false,
cache: false,
url: (domain + pathSeparator + pathToPHP),
async: true,
success: function (data, textStatus, jqXHR) {
if( parseInt(data) > messagesCounterFromPage ){
$("#new_messages_counter").text("Сообщения: " + data); // it's work
document.getElementById("message_notification").play(); // it isn't work
messagesCounterFromPage = data;
}
}
});
}
这适用于Firefox,不适用于最新的Chrome . 音频文件很小,问题跟踪器写了修复小文件修复的错误 . 我仍然从228千字节更多的文件,但没有任何改变 . 这真的是一个错误,还是我是个傻瓜?在bug跟踪器中与自动播放类似,但未确认 .