謝謝@Ray。作爲參考,我現在使用最新的FineUploader version 5.3.0
。 正如您所建議的那樣,多個屬性被刪除。我把它追蹤到下面的input.removeAttribute("multiple");
代碼(s3.fine-uploader.js):
setMultiple: function(isMultiple, optInput) {
var input = optInput || this.getInput();
// Temporary workaround for bug in in iOS8 UIWebView that causes the browser to crash
// before the file chooser appears if the file input doesn't contain a multiple attribute.
// See #1283.
if (options.ios8BrowserCrashWorkaround && qq.ios8() && (qq.iosChrome() || qq.iosSafariWebView())) {
input.setAttribute("multiple", "");
}
else {
if (isMultiple) {
input.setAttribute("multiple", "");
}
else {
input.removeAttribute("multiple");
}
}
},
儘管options.ios8BrowserCrashWorkaround
被設置爲true,在我的代碼(ios8BrowserCrash: true
),該計劃仍在繼續,通過對removeAttribute("multiple")
行代碼時在iPad/Safari上運行。 經過多次嘗試和錯誤,我發現(可能...)庫代碼缺少在iPad(iOS 8.3)上測試條件qq.iosSafari()
的測試; qq.iosSafariWebView()
測試不足以檢測我的iPad上的Safari瀏覽器,因此缺少設置multiple屬性的代碼。 我發現我的調用代碼中的以下選項值修復了此問題。
function initialiseS3() {
uploader = new qq.s3.FineUploader({
element: $element[0],
template: $(contents)[0],
debug: false,
// iosEmptyVideos workaround must be false to enable FineUploader to keep multiple:true in iOS
workarounds: {
iosEmptyVideos: false,
ios8BrowserCrash: true
},
// Must add the test qq.iosSafari() to set multiple to true and have the camera turned off on iPad
multiple: qq.ios8() && (qq.iosSafari() || qq.iosChrome() || qq.iosSafariWebView()) ? true : false,
camera: {
ios: false
},
… (more initialisations)
`
最後漁獲來覆蓋的解決方法選項iosEmptyVideos
默認值,並將其設置爲iosEmptyVideos: false
,以避免再次庫迫使multiple
爲false。我希望這是有道理的......
如果'multiple'屬性在文件輸入元素上不存在,您將有權訪問iOS相機。因此,我期望有一些設置會導致Fine Uploader將該屬性從它創建並打包的文件輸入中移除。 –