0
我想使用jquery-ifram-transport和nodejs設置一個簡單的文件上傳問題是我不斷收到錯誤捕獲SecurityError:阻止了一個框架原產地"https://localhost:8081"
訪問源「serverURL」的幀。協議,域和端口必須匹配。試圖從快遞發送一個響應到jquery-iframe-transport
這裏是我的客戶,從客戶端AJAX代碼
var uploadXhr = $.ajax($scope.nodeSocketUrl + '/upload?tenant=qa',{
data: $(':text', form).serializeArray(),
files: $('#presentationFileUpload'),
type: 'POST',
iframe: true,
processData: false,
context: this
});
這裏只是有一個很難得到這個插件具有強大的工作,我想了請求被髮送回客戶端一樣哎文件IM已經上傳了這樣的東西。
form.on('end',function(){
res.header({'content-type': 'text/html'});
res.send('<html><textarea data-type="application/json">{"ok": true, "message": "Thanks so much"}</textarea></html>');
});
任何人誰知道如何從快遞發回的請求到一個jQuery的iframe,運輸Ajax請求會在這裏一個巨大的幫助。這裏
更新是我目前的CORS設置
app.all('/*', function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Credentials', true);
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');
res.header('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Authorization');
next();
});
加入我的CORS在評論 –
再次 – tpae
檢查編輯雅去命令行並輸入start chrome --disable-web-security同樣的錯誤發生小號 –