browser-image-resizer icon indicating copy to clipboard operation
browser-image-resizer copied to clipboard

Doesn't work on Wkwbview

Open Aarbel opened this issue 4 years ago • 6 comments

This library doesn't seem to work on wkwebview (capacitor / cordova / ionic app).

Debug doesn't throw any log / error when passing a file to resizeAndCompressImage

Maybe you use APIs not available on wkwebview

Do you plan to fix it ?

Aarbel avatar Mar 23 '21 11:03 Aarbel

@Aarbel looks like WKWebView has some specific, platform-level limitations: https://cordova.apache.org/news/2018/08/01/future-cordova-ios-webview.html

Checking those issues, quite a few have been closed but there must be something we're doing in code that runs afoul of its limitations.

I unfortunately don't have time to research but would very much welcome a PR if you hunt it down.

ericnograles avatar Mar 23 '21 11:03 ericnograles

@ericnograles

Logs like that in chrome, but dosn't work and blocks the code on wkwebview: image

image

Aarbel avatar Mar 23 '21 12:03 Aarbel

If also posted a request on capacitor repo: cf https://github.com/ionic-team/capacitor/discussions/4389

Would be awesome for hybrid devices to compress images client side

Aarbel avatar Mar 23 '21 12:03 Aarbel

Interesting -- if it's blocking the code on the WebView, perhaps there's something with either the callbacks or promise resolution that WKWebView doesn't like.

ericnograles avatar Mar 23 '21 12:03 ericnograles

FWIW, for hybrid apps, it sorta feels like Cordova should have a mechanism to do that for you using either iOS or Java code since it'll probably be more battery and CPU efficient handling binaries, so that's a good feature request.

ericnograles avatar Mar 23 '21 12:03 ericnograles

Yes, native handler would be much better

Aarbel avatar Mar 23 '21 13:03 Aarbel