For my research project, I am exploring the possibilities of .epub files and experimenting with embedding JavaScript code to display data visualizations. I am currently using calibre to convert an HTML file containing D3 scatterplots into an .epub. The scatterplots show data visualization perfectly when viewed in a browser, but the .epub file created with calibre appears empty. I am curious to know if it is possible to execute JavaScript code within an .epub file. Given that EPUB 3 is said to resemble a modern browser, I would assume that rendering web content is feasible, but I am uncertain as to why my D3.js code is not loading properly. Unfortunately, calibre does not provide any feedback to troubleshoot the issue.
<!-- Code from d3-graph-gallery.com -->
<!DOCTYPE html>
<meta charset="utf-8">
<!-- Load d3.js -->
<script src="https://d3js.org/d3.v4.js"></script>
<!-- Create a div where the graph will take place -->
<div id="my_dataviz"></div>
<script>
// JavaScript code for creating scatterplots using D3
// This code is supposed to load data and generate the scatterplot
</script>