Reading Epub files using HTML and Javascript from Android Asset folder?

I want to read the EPUB files that are in the Assets folder. I have an HTML file. In which I mentioned epub.min.js and provided the location of the epub file for reading the file. But the epub file was not uploaded. Can anyone suggest me how to read epub files using html and javascript in Android?

File location

Asset/Sample/index.html
Asset/sample/epub.min.js
Asset/Sample/jquery-1.10.2.min.js
Asset/Sample/Epub file folder. All html, images are available in this folder

<!DOCTYPE html>
<html class="no-js">
    <head> 
        <script src="jquery-1.10.2.min.js"></script>
            <!-- Render -->
            <script src="epub.min.js"></script> 
        <script type="text/javascript">    
        var book = ePub("Azure_Cosmos_DB_and_DocumentDB_Succinctly/");
          $(document).ready(function () {
          book.renderTo("area");
        });        
    </script>
    </head>
    <body>
 <div id="main">
    <div id="prev" onclick="book.prevPage()" style="font-size: 64px;cursor:pointer;" class="arrow"></div>
    <div id="area" style="height:500px;"></div>
    <div id="next" onclick="book.nextPage()" style="font-size: 64px;cursor:pointer;" class="arrow"></div>    
</div>    
    </body>
</html>

      

+3


source to share


1 answer


Try it.

if(Build.VERSION.SdkInt >= Build.VERSION_CODES.JellyBean)
{
 webView.Settings.AllowUniversalAccessFromFileURLs = true; 
 webView.Settings.AllowFileAccessFromFileURLs = true;
}

      



Also save your script files directly to your assets folder, not to internal folders.

+1


source







All Articles