Hi, is there anyone displaying local images stored by cordova file
whilst using WKWebview ? I read that WKWebView doesn’t support file://
and removing it should work (as per @mhartington’s comment here)
so this is my code:
(Note: I am using the ionic team’s WKWebview fork via ionic cordova plugin add https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git --save
// Always get the accurate path to your apps folder
public getFullPath(img) {
let path = this.file.dataDirectory + img; // same as cordova.file.dataDirectory
if (this.platform.is('ios'))
{
//console.log ("removing path...");
if (path.startsWith("file://")) {
path = path.slice(7);
//console.log ("SLICED");
}
// an example of the path returned /var/mobile/Containers/Data/Application/9EFDFC21-754D-46BF-890C-A2CAE8B4361C/Library/NoCloud/1499219374621.jpg
}
}
And the template does
<img src="{{getFullPath(item.photo)}}" />
Everything works without WKWebView. Thanks