Issue
I am using this code to save client-generated PNG files:
my_canvas.toBlob (function (blob) {window.saveAs (blob, my_filename)}, 'image/png')
I'm using these for cross-browser compatibility:
- JavaScript Canvas to Blob 2.0.5 by Sebastian Tschan, https://github.com/blueimp/JavaScript-Canvas-to-Blob.
- FileSaver.js by Eli Grey, http://eligrey.com.
Works perfectly in IE10+, Chrome, Firefox, Chrome Android, but breaks down in the base web view engine in 4.3. Since I'm trying to lightly use Phonegap here and make it compatible with somewhat non-new current devices mobile, I need it to work in the Android WebView 4.3, at least.
Q & A:
Q: How does it break down?
A: Sends me to a non-existent URL instead of making an image and opening it.
Solution
I've had many problems with canvas, blobs and old versions of android.
On some version you have to use BlobBuilder, on others WebKitBlobBuilder (on some versions BlobBuilder is there but not correctly implemented), Canvas.toDataURL is not present before android 3 and does not work correctly before 4.x...
For all those reasons I finally used the Canvas2ImagePlugin for android devices and now my app works even in android 2.3.
You can keep your code with browser by testing window.canvas2ImagePlugin and using it if it's found and continue to do what you've been doing if it's not.
Answered By - QuickFix
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.