Hi,
I am using file and file transfer plugin to download a zip file and ionic zip plugin to extract the downloaded zip.
The zip file contains images and many json files. After extracting the zip file, I uses httt.get() method to get the locally downloaded json files. But I am getting the following error:
Failed to load file:///data/user/0/com.newzipper.com/files/edition1/563177.json: Cross origin requests are only supported for protocol schemes: http, data, chrome, https.
My code is as follows:
this.unzip_file_path = navParams.get('zip');
this.file.createDir(this.file.dataDirectory, 'edition1', true).then((data) => {
this.zipper_path = data.nativeURL;
this.zip.unzip(this.unzip_file_path, this.zipper_path).then((result) => {
},
err => {
console.log(err, "err");
});
});
this.file.checkDir(this.file.dataDirectory, 'edition1').then((data) => {
this.file_deleted = 0;
this.loadData();
},
err => {
console.log(err,"error 1");
});
}
loadData(){
var link = this.file.dataDirectory + "edition1/editionindex.json";
this.file.checkFile(this.file.dataDirectory , "edition1/editionindex.json").then((fileexist) => {
this.http.get(link).map(res => res.json()).subscribe((data) => {
console.log(data, "data");
},
err => {
console.log(err, "err");
})
},
err => {
console.log(err, "error in file");
});
}
Any suggestion is appreciable.
Thanks