Skip to content

Commit

Permalink
fix(ios-webview): loading of local-file dependency (#6947)
Browse files Browse the repository at this point in the history
Fixes loading of html dependencies when loading a local file to web view.

I've just implemented the code changes in the patch provided by @gregorywojcik [here](#6377 (comment))

references #6377
  • Loading branch information
imerljak authored and Alexander Vakrilov committed Feb 26, 2019
1 parent bb5cec3 commit dcad754
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tns-core-modules/ui/web-view/web-view.ios.ts
Expand Up @@ -131,7 +131,8 @@ export class WebView extends WebViewBase {

public _loadUrl(src: string) {
if (src.startsWith("file:///")) {
this.ios.loadFileURLAllowingReadAccessToURL(NSURL.URLWithString(src), NSURL.URLWithString(src));
var cachePath = src.substring(0, src.lastIndexOf("/"));
this.ios.loadFileURLAllowingReadAccessToURL(NSURL.URLWithString(src), NSURL.URLWithString(cachePath));
} else {
this.ios.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString(src)));
}
Expand Down Expand Up @@ -160,4 +161,4 @@ export class WebView extends WebViewBase {
public reload() {
this.ios.reload();
}
}
}

0 comments on commit dcad754

Please sign in to comment.