Skip to content

Commit

Permalink
fix(wkwebview): images not loading in Ionic WKWebView (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoRoth authored and ihadeed committed Jun 18, 2018
1 parent 4f65317 commit db16dc2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/providers/image-loader.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { DirectoryEntry, File, FileEntry, FileError } from '@ionic-native/file';
import { HttpClient } from '@angular/common/http';
import { normalizeUrl } from 'ionic-angular';
import { ImageLoaderConfig } from "./image-loader-config";
import { Platform } from 'ionic-angular';
import { Observable } from 'rxjs/Observable';
Expand Down Expand Up @@ -452,8 +453,8 @@ export class ImageLoader {
// therefore the file needs to be copied into that directory first!
if (this.isIonicWKWebView) {

// Ionic WKWebView can access all files, but we just need to replace file:/// with http://localhost:8080/
resolve(fileEntry.nativeURL.replace('file:///', 'http://localhost:8080/'));
// Use Ionic normalizeUrl to generate the right URL for Ionic WKWebView
resolve(normalizeUrl(fileEntry.nativeURL));

} else if (this.isWKWebView) {

Expand Down

0 comments on commit db16dc2

Please sign in to comment.