我正在使用这个简单的脚本在网站中播放背景音频主题,是否可以预发放手机上的播放?在手机上禁用音频背景
$(document).ready(function() {
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', 'audio/theme.mp3');
audioElement.setAttribute('autoplay', 'autoplay');
audioElement.volume = 0.1;
audioElement.loop = true;
$.get();
audioElement.addEventListener("load", function() {
audioElement.play();
}, true);
[JavaScript的 - 检测移动浏览器](http://stackoverflow.com/questions/11381673/detecting-a-mobile-browser) –
有没有文字来描述我是如何讨厌找到播放背景音频的网页...我通常关闭网页立即继续收听我的音乐。 – Lyall
在awwwards.com上有一些世界上最好的使用音频背景的网站。所以我认为人们可以在离开网站之前点击开/关音频按钮。这将使电影的网站和音频成为导航体验的一部分。 – vlk