人们似乎没有本土的解决方法,这似乎是一个已知的问题,无论being fixed in webkit.
开始咆哮
苹果缺乏支持,关注独立应用程序的细节确实令人难以置信;尤其是9.3.5版。
在此问题和独立应用程序中的主要Youtube player issue之间。或许苹果应该停止担心取下耳机插孔,并增加了一些神秘的“触摸条,实际上解决他们该死的平台。
结束咆哮
你将不得不使用FastClick来解决这个问题。应用它只适用于iOS,你可以走得更远,只适用于独立应用程序,因为如果应用程序不是独立的,它可以正常工作。
我的脚本标签放在DOM之后,初始化看起来像这样:
if (isIos() && isRunningStandalone()) {
// Initialize Fast Click
// Even with the latest webkit updates, unfortunatley iOS standalone apps still have the 350ms click delay,
// so we need to bring in fastclick to alleviate this.
// See https://stackoverflow.com/questions/39951945/ios-standalone-app-300ms-click-delay
if ('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body);
}, false);
}
}
isIos = function() {
// Reference: https://stackoverflow.com/questions/9038625/detect-if-device-is-ios#answer-9039885
return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
};
isRunningStandalone = function() {
// Bullet proof way to check if iOS standalone
var isRunningiOSStandalone = window.navigator.standalone;
// Reliable way (in newer browsers) to check if Android standalone.
// https://stackoverflow.com/questions/21125337/how-to-detect-if-web-app-running-standalone-on-chrome-mobile#answer-34516083
var isRunningAndroidStandalone = window.matchMedia('(display-mode: standalone)').matches;
return isRunningiOSStandalone || isRunningAndroidStandalone;
};
这个问题似乎是在iOS的11独立的Web应用程序,现在固定的工作。另请参阅:https://forums.developer.apple.com/thread/43415 – user2309038