Open hz0324 opened 7 years ago
Please try the following fix from this Pull Request: https://github.com/readium/readium-js/pull/73
(in fact, to make things simpler in your tests, just force var isIE = true;
, and check the results)
Hello,
I don't know if that issue is related to mine ( #599 ) but i found out a solution that worked for me so maybe i can help.
there were two problem :
we used code like this
<html id="simpleViewer">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="0; url=reader.html?epub=epub_content/Book">
<link href="images/readium_favicon.png" rel="shortcut icon"/>
<link href="images/readium-touch-icon.png" rel="apple-touch-icon"/>
</head>
</html>
I found out that android was not supporting ( or i don't success to make it work ) the parameter " ?epub=epub_content/Book"
So i had to modify manually the readium-js-viewer_all_LITE.js script to directly have the path to "epub_content/MyBook" without js searching it through url parameter
the mixedContentMode props from react-native webview doesn't solve my problem...
the only solution i found to make it works is to use 3rth party library : https://github.com/lucasferreira/react-native-webview-android
making a if condition( Platform.os == 'android' ) { // use android webview library } else { // use normal webview }
I don't know if all of this may help you but it is how i success to make works readium on my react-native app ( android ).
Thank you for the tips regarding the ReactNative webview!
Note that is you are willing to write a complete "receipe" for embedding Readium JS in a React Native app, useful for other developers, we'll be happy to host your post on www.edrlab.org.
We are trying to use Readiumjs to make a ePub reader for android and ios. Our plan is to use React Native and the Webview to write the app.
The WebView will host a single page web app and using the ReadiumJS as the core. Basically, the core code are as below:
This works very well on iOS webview, but having some undebugable problems on Android. The most obvious problem is : The iframe is attached to designated DIV, but its document is empty. At meanwhile, the TOC rendered correctly. We also fount that, it never reaches the
ReadiumSDK.Events.CONTENT_DOCUMENT_LOADED
event callback.I have tried to load the cloud reader (https://readium.firebaseapp.com ) inside the webview, it has the same problem. I really don't know how to solve it, please help.
I have made some screenshots showing you guys the problem. They are from Chrome remote debug tool, showing the console for a real Android device's webview.
Here are the whole console info ( three sreenshots):
This one shows the correct TOC content:
This one shows the empty document under iframe:
FYI, the two devices below have the sample problem
The cloud reader is also working on the newest Chrome for Android, here is the screenshot.