1

I tried out the image blog storage in IndexDB talked about in this article

But with Chrome V23 I am getting this error:

Uncaught Error: DataCloneError: DOM IDBDatabase Exception 25 base.js:52
    putElephantInDbbase.js:52
    (anonymous function)

Here is the code snippet: (blob is an xhr.responseType = "blob" that holds elephant.png (as per the example at the top). The error happens on the last line.

var transaction = db.transaction(["elephants"], "readwrite");
var store = transaction.objectStore("elephants");
var req = store.put(blob, "image");

I am assuming binary blob PUT is not yet supported, correct? (It does work in FireFox 17, and IE 10)

Dr.YSG
  • 6,072
  • 13
  • 61
  • 121

1 Answers1

2

I guess you are right and it's not (yet) supported. Here is the bug/request that deal with this issue: https://code.google.com/p/chromium/issues/detail?id=108012

Ido Green
  • 2,771
  • 1
  • 14
  • 24
  • Todah Rabbah! Since I see you are a TRUE expert, is there anything you can point me at to tell me about relative performance/architecture issues in Chrome when using FileSystemAPI versus IndexedDB (See my article @ http://stackoverflow.com/questions/14113278/storing-image-data-for-offline-web-application-client-side-storage-database). I.e. If use a FileSystemAPI PolyFill for Chrome for Windows & Android, would this be smart? Or should I go the other way? – Dr.YSG Jan 02 '13 at 18:55
  • It seems that your best option will be to go with something like: http://smus.com/game-asset-loader/ - Boris did a great job on it ;) – Ido Green Jan 03 '13 at 08:08
  • Does the FileSystemAPI work on Chrome for Android? (I asked caniuse.com to break things out for me). I agree, Boris did a good job on this. But I am seeing lots of resistance to FileSystem API from FireFox https://hacks.mozilla.org/2012/07/why-no-filesystem-api-in-firefox/ (and forget about IE, which is my sponsors browser). So it looks like roll my own polyfill for now. – Dr.YSG Jan 03 '13 at 17:36
  • The FileSystem API is supported on chrome for android. Btw, you have a js shim that let you have the FILE API on FF and IE 10 - https://github.com/ebidel/idb.filesystem.js – Ido Green Jan 08 '13 at 13:27
  • I tested IE10 last week, it did not work. Submitted an issue, since it should work. But yes, that is a good piece of work. – Dr.YSG Jan 09 '13 at 19:41
  • 1
    I am now using PouchDB for storing binary blobs. It uses indexedDB but for Chrome, it first changes the binary to base64. Which works in the meantime. – Dr.YSG May 24 '13 at 16:50