I created an HTML file that is displaying some curves.
This HTML file contains some JavaScripts. Each script is called to load only one curve.
The first line of my HTML file are following
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LoiNormale_xT</title>
<script src="D:/@Projets/JavaScript/InitChartJS.js"></script>
<script src="./1T.js"></script>
<script src="./2T.js"></script>
<script src="./3T.js"></script>
<script src="./4T.js"></script>
<script src="./5T.js"></script>
</head>
On Windows 11, when I click on graph.html
file, the five curves are correclty displayed in Chrome browser.
Now, for distribution purpose, I search a solution to put all these files (html and javascript) in a specific Zip file.
To do that, I have compressed all html and javascript that are actually in same folder in a specific ZIP file named Charts.LoiNormale_xT.zip
.
In Windows File Explorer, I can click on zipped file to open it; but when I click on graph.html
file to display it as before when this file is in a window directory, Chrome display only a red background.
On development console, I can read following error’s messages
How can I reference a local JavaScript from an HTML file contained in same Zip file ?
My goal is to distribute a local HTML file composed of multiple files in sending only one file (container). The receiver has only to open zip file and to click on graph.html
file to display the graph on his favorite browser.
Some supplementary informations
When all files are in a windows directory, all curves are correctly displayed.
Replacing "./1T.js"
by "1T.js"
in <script>
tag displays same errors.
I use JavaScript to define a variable that is used by Chart.js
to define a curve. The variable’s definition is not added directly in HTML file to separate DATA (curve) from CODE (html file). If I put curve’s data in html file, html file is too big and ‘unreadable’ !