javascripthtmljqueryepub.js

Could not make epub reader show up with Epub.js from futurepress


I am building a web app where I try to display a epub reader in the page using Epub.js from futurepress. However, I could not get the reader show up even with the example book link. Could anyone tell me where I did wrong?

HTML:

<div id="viewers"></div>
<button type="button" class="btn btn-success btn-sm">Read now</button>

<script src="https://cdn.jsdelivr.net/npm/epubjs/dist/epub.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.5/jszip.min.js"></script>

enter image description here

enter image description here

Even the API request returns 200, nothing is happening on the webpage. (PS: For HTML, button is not originally there, I used jquery to render the button, but I don't think this is a problem)


Solution

  • You need to add an additional option to ePub function

    ePub("https://s3.amazonaws.com/moby-dick/moby-dick.epub", { openAs: "epub" })