Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WKWebView support #24

Open
bojanvidanovic opened this issue May 17, 2016 · 4 comments
Open

WKWebView support #24

bojanvidanovic opened this issue May 17, 2016 · 4 comments

Comments

@bojanvidanovic
Copy link

Has anybody managed to make this plugin work with wkwebview with local server?

@jd0048
Copy link

jd0048 commented Aug 18, 2017

Any updates for WKWebView?
it will give me error "Not allowed to load local resource"

@bojanvidanovic
Copy link
Author

@jd0048 Nope. I don't recommend you using it, it is out-dated at the moment.

@devfelipereis
Copy link

Hello guys! I'm using this lib for an Ionic app and it works fine on android. Today I started with iOS and I'm using cordova-plugin-ionic-webview.
I fixed and I want to share with you.

You need to ionic-cache-src.js and search for:

case 'iOS':
  return $window.cordova.file.documentsDirectory;

change $window.cordova.file.documentsDirectory; to $window.cordova.file.documentsDirectory.substring(7);.

It should work. It's a simple hack but it works if you need something fast.

Why this works?

When accessing files using WKWebView, you can not use "file://". That's why I'm using substring(7) there(to cut off that part).

You can get a ref from here: https://ionicframework.com/docs/wkwebview/#rewriting-file

Hope this helps!

@julitroalves
Copy link

@devfelipereis thanks a lot, you help me so much.
An improved way to perform your fix is to change to this:
window.Ionic.WebView.convertFileSrc($window.cordova.file.documentsDirectory);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants