I have a index.html
page and link to another javascript file d3.html
. In d3.html
javaScript file the javaScript code do some interesting stuff with a local file amazon.txt
(in my computer). I code and test in local XAMPP web server and everything works fine. However, if i close the XAMPP (web server), the d3.html
cannot be loaded. The d3.html
have an error Cross origin requests are only supported for protocol schemes
In index.html
:
<p><a href="d3.html">link</a></p>
in d3.html
:
$.get('amazonCut.txt', function (data) {
// interesting stuff
}
If I close XAMPP, index.html can be loaded but d3.js cannot. I browsed the stackoverflow and changed above code to:
<p><a href="http://localhost/d3.html">link for complete result </a></p>
and
$.get('https://localhost/amazonCut.txt', function (data) {
// interesting stuff
}
but it won't work. The reason I am doing this because the instructor only clicks the index.html file when grading without setting any web server.