0
我的代碼在Chrome中運行良好,但它在IE中出錯。該消息是:在IE 9中jQuery圖片上傳(blueimp)報告錯誤9
空文件上傳結果
和1E示出了一個跨站點腳本錯誤消息。但文件上傳效果很好。
我只用我的服務器鏈接改變了「main.js」。
$(function() {
'use strict';
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
// url: 'server/php/'
url: './jQuery-File-Upload-master/server/php/'
});
// Enable iframe cross-domain access via redirect option:
$('#fileupload').fileupload(
'option',
'redirect',
window.location.href.replace(
/\/[^\/]*$/,
'./jQuery-File-Upload-master/cors/result.html?%s'
)
);
if (window.location.hostname === 'mimong4.cafe24.com') {
// Demo settings:
$('#fileupload').fileupload('option', {
url: './jQuery-File-Upload-master/server/php/index.php',
maxFileSize: 5000000,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/I,
process: [
{
action: 'load',
fileTypes: /^image\/(gif|jpeg|png)$/,
maxFileSize: 20000000 // 20MB
},
{
action: 'resize',
maxWidth: 1440,
maxHeight: 900
},
{
action: 'save'
}
]
});
// Upload server status check for browsers with CORS support:
if ($.support.cors) {
$.ajax({
url: './jQuery-File-Upload-master/server/php/index.php',
type: 'HEAD'
}).fail(function() {
$('<span class="alert alert-error"/>')
.text('Upload server currently unavailable - ' +
new Date())
.appendTo('#fileupload');
});
}
} else {
// Load existing files:
$.ajax({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: $('#fileupload').fileupload('option', 'url'),
dataType: 'json',
context: $('#fileupload')[0]
}).done(function (result) {
$(this).fileupload('option', 'done')
.call(this, null, {result: result});
});
}
});