pgaskin / ePubViewer

ePub viewer with dictionary, themes, search, offline support, and more
http://pgaskin.net/ePubViewer
MIT License
338 stars 74 forks source link

Android #10

Closed mendelp closed 4 years ago

mendelp commented 4 years ago

Hi Tried using this in an Android webview and got the following error: {"error":"TypeError: Cannot read property 'getItem' of null","stack":"TypeError: Cannot read property 'getItem' of null\n at App.restoreChipActive (file:///android_asset/ePubViewer-gh-pages/script.js:146:26)\n at file:///android_asset/ePubViewer-gh-pages/script.js:142:100\n at Array.forEach ()\n at App.loadSettingsFromStorage (file:///android_asset/ePubViewer-gh-pages/script.js:142:74)\n at new App (file:///android_asset/ePubViewer-gh-pages/script.js:90:14)\n at file:///android_asset/ePubViewer-gh-pages/script.js:690:18"} When I run it in a browser it runs fine.

pgaskin commented 4 years ago

ePubViewer uses LocalStorage to store position and pagination data. This isn't enabled by default in Android WebViews, so you need to enable it with webView.getSettings().setDomStorageEnabled(true);.