【问题标题】:Read Epub Files using HTML and Javascript from Android Asset folder?从 Android Asset 文件夹中使用 HTML 和 Javascript 读取 Epub 文件?
【发布时间】:2017-05-26 05:34:18
【问题描述】:

我想阅读位于 Assets 文件夹中的 EPUB 文件。我有一个 HTML 文件。我在其中提到了 epub.min.js 并提供了一个 epub 文件位置来读取文件。但是没有加载 epub 文件。谁能建议我如何在 Android 中使用 html 和 javascript 读取 epub 文件?

文件位置

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>

【问题讨论】:

    标签: android jquery html epub


    【解决方案1】:

    试试这个。

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

    另外,请将脚本文件直接保存在资产文件夹中,而不是保存在内部文件夹中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-01
      • 2017-04-19
      • 2013-08-02
      相关资源
      最近更新 更多