I am trying to run a very simple JavaScript (e.g. 3Dmol.js) with VS Code and Firefox (v 91) on ubuntu 20.04.
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>3Dmol.js Surface Test</title>
<script src="../build/3Dmol.js"></script>
<div class="align-center">
<div id="container" class="mol-container"></div>
</div>
<script type="text/javascript">
$(function() {
$.get("/home/me/Documents/veloxchem_workshop/density_a_mox.cube", function(data){
var voldata = new $3Dmol.VolumeData(data, "cube");
});
});
</script>
</head>
</html>
I have configured the launch.json to target a specific html and the script is running,
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch test.html",
"type": "firefox",
"request": "launch",
"reAttach": true,
"file": "/home/me/Documents/3Dmol.js/examples/volumetric.html"
}
]
}
but there are two errors in console:
XML Parsing Error: syntax error
Location: file:///home/me/Documents/3Dmol.js/tests/auto/data/test.cube
Line Number 1, Column 1: test.cube:1:1
XML Parsing Error: syntax error
Location: file:///home/me/Documents/3Dmol.js/examples/volumetric.html
Line Number 1, Column 1: volumetric.html:1:1
which prevents the .cube file to be read, and more mysteriously the html file its self to be read (?). I have read about changing the type of the variable to force the parsing using Content-Type: "text/plain", but I haven't understood how to implement it in my html.
Any idea how to solve the issue?