axemclion / jquery-indexeddb

An IndexedDB Plugin for Jquery.
Other
195 stars 71 forks source link

Error on android mobile and PhoneGap #13

Closed fauguste closed 11 years ago

fauguste commented 11 years ago

When I use indexeddb on Android mobile (4.0) with PhoneGap (2.0), I have this error : 09-07 11:45:58.505: E/Web Console(30212): Uncaught TypeError: Illegal constructor at file:///android_asset/mobile/js/jquery.indexeddb.js:281

I patched this line 281 with the following line : var event = new jQuery.Event("upgradeneeded");

And now, it is working find.

Could you confirm that is a the good solution and patch your file ?

Thanks, Regards

axemclion commented 11 years ago

Right now, line 281 says var newVersion = typeof version === "undefined" ? (oldVersion === 0 ? 1 : oldVersion) : parseInt(version, 10);

Not sure how replacing a var event = ... will help.

Would be great if you could make the change in a fork and send me the patch request. Also, is this more like a Phone Gap app where you have included the jquery indexeddb file (from the file URL), or are you accessing this from a website on the android browser ?

fauguste commented 11 years ago

I patched this line 286 (last release) with the following line : var event = new jQuery.Event("upgradeneeded");

I use Phone Gap app where I have included the jquery indexeddb file in the android package.

axemclion commented 11 years ago

Looking at this issue now - creating a sample project to check if the proposed fix works on all versions.

axemclion commented 11 years ago

Do you have a sample android app set up that I could use to test this ?

axemclion commented 11 years ago

Hi,

Here is a working Android example http://blog.nparashuram.com/2012/10/indexeddb-example-on-cordova-phonegap_12.html.

Can you try this and see if works ?