Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
JavaScript Content Not Loading On Page (epub.js)

I'm trying to use epub.js library, and am trying to get the barebones running. The problem is the ebook is not displaying in my browser:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <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>

    <title>Document</title>
</head>
<body>
        
    <div id="area"></div>
    
    </body>

    <script>
      var book = ePub("steinbeck-of-mice-and-men.epub", { openAs: "epub" });
      var rendition = book.renderTo("area", {width: 600, height: 400});
      var displayed = rendition.display();  

      book.renderTo("area", { method: "default", width: "100%", height: "100%" });

    </script>
</html>

I have the steinbeck-of-mice-and-men.epub in my directory, but it's just a blank page.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It seems your path is incorrect. Use the correct path if the file is in the same directory where you are keeping the HTML.

 <script>
      var book = ePub("./steinbeck-of-mice-and-men.epub", { openAs: "epub" });
      var rendition = book.renderTo("area", {width: 600, height: 400});
      var displayed = rendition.display();  

      // book.renderTo("area", { method: "default", width: "100%", height: "100%" }); // why are you rendering it again?

    </script>

You can check the documentation here.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!