View Single Post
Old 03-03-2023, 11:09 AM   #1
salmobytes
Junior Member
salmobytes began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Apr 2022
Location: •••••••
Device: pixel3xl
javascript in epub

This is a development question.
I'm an experienced developer in other contexts, but entirely new to epub.
I'm writing a Python utility to convert my website to epub3
I am finally getting output epubs that validate with epubcheck.
Error free.

I start with HTML fragments scraped from a website.
make a recursive list of all links on all pages, as a text file in sequential order
Loop through that link list line by line and make calls to python codes using ebookLib,
that make a new epub. (epub3 fwiw)

The epub I get fails with errors if anything like:

loading="lazy" (css)
onClick="bigImage(this)" (javascript)

...remain in the HTML fragments.
I get an epub that does validate if I strip all that stuff first.

Is there a way to configure something in content.opf perhaps, so that js and css stuff would not have to be stripped? The error I get for that stuff is
ERROR(OPF-014): The property 'scripted' should be declared in the OPF file.

How would I declare it?

I don't expect javascript to work inside an epub reader. But it wold be handy if I did not have to strip it out.


Do any epub readers support any subset of javascript in the epub?
salmobytes is offline   Reply With Quote