View Single Post
Old 02-15-2021, 10:15 AM   #3
jrv
Junior Member
jrv began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2021
Device: none
Quote:
Originally Posted by kovidgoyal View Post
dont use window.load use DOMContentLoaded
Thank you. DOMContentLoaded and window.onload (my typo in previous post) are semantically different (https://javascript.info/onload-ondom...#window-onload). DOMContentLoaded occurs after the DOM is loaded but before external files have loaded. I want to include an external (to the page, but internal to the .epub) javascript file using:

Code:
<script src="javascript/tabs.js"></script>
There is a function in the javascript function that is called to initialize the page, so window.onload is semantically the right place to call it. The initialization references one or more elements by id and is custom to each page. I also would prefer not having to include the contents of the included .js file in each .html file; it is common code that would have to be repeated on each page.

Is it correct calibre ebook-viewer does not support this DOM event? Is there an event that is semantically similar, i.e. after loading all resources, that could be used instead?

JR
jrv is offline   Reply With Quote