I am being write a program using javascript and cordova plugin, otherwise some of download and upload methods using cordova FileTransfer.
But unfortunately when download or upload any file, It always show :
"Access to XMLHttpRequest at 'http://doc.google.com/www/data/survey/test.txt' from origin 'http://localhost:007/index.html#home' has been block by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Here is the download script:
let fileTransfer = new FileTransfer(), store = cordova.file.dataDirectoy;
fileTransfer.download("http://doc.google.com/www/data/survey/test.txt", store + "test.txt",
function(entry) { ... },
function(error) { console.log(error); },
false,
{
headers: {
"Access-Control-Allow-Origin": "*",
"Content-Type": "text/plain",
"Authorization": "Basic dGVzdHVzZXJuYW1lOnR1c3RwYXNzd29yZA=="
}
}
);
Anybody could help pls?
How to tell browser for "CORS permit" using cordova FileTransfer?
Thanks in advance.