epub Book Error: Blocked script execution in ‘http://localhost:8080/’ because the document ‘s frame is sandboxed and the ‘allow-scripts’ permission is not set.

initEpub() {
      const url = 'http://localhost:8081/epub/' +
        this.fileName + '.epub'
      // console.log(url)
      this.book = new Epub(url)
      console.log(this.book)
      this.rendition = this.book.renderTo('read', {
        width: window.innerWidth,
        height: window.innerHeight,
        method: 'default'
      })
      this.rendition.display() 
    }
  },

 

Reason:

This problem is because of the iframe framework, which is used in epub!

 

Your e-book is placed in the iframe!

If you delete:

method : The 'default' 
 e-book can also be rendered, but the error is not resolved!

 

Solution:

My reason: because of the problem of the epub.js package, the version is relatively high! Uninstall this package and start over

Uninstall:

npm uninstall epubjs

Reload the next specified version of the package:

npm install [email protected]

 

Rendering is successful, no error is reported!

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *