【发布时间】:2017-05-16 15:04:00
【问题描述】:
我使用 .htaccess 通过密码保护网站。
如果我在该网站上使用 html5 音频元素,我的 Ipad 在每次重新加载时都需要网站密码,尽管它已保存在浏览器中。
仅在 Ipad 上。没root,都是原装ios。 在 Ipad 上使用 Chrome 和 Safari 进行测试,始终相同。
如果页面上没有音频元素,则不需要密码。
这不会发生在 Android 平板电脑或 Windows 的 Firefox 上。
我可以编写什么程序来防止 Ipad 要求输入密码?
我使用此网站上的以下code。
<!DOCTYPE HTML>
<html>
<head>
<title>Audio</title>
</head>
<body>
<script>
function play(){
var audio = document.getElementById("audio");
audio.play();
}
</script>
<input type="button" value="PLAY" onclick="play()">
<audio id="audio" src="./207.wav"></audio>
</body>
</html>
.htaccess:
AuthType Basic
AuthName name123
AuthUserFile /somepath/.htpasswd
require valid-user
SetEnv no-gzip
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
AddDefaultCharset UTF-8
【问题讨论】:
-
我猜您需要提供 .htaccess 文件以进行其他故障排除?
-
当然,谢谢。
标签: javascript html ios ipad html5-audio