I am new to javascript and am trying to get this to work. When I link to my external .js file from my HTML it doesn't work, but when I enter the script directly in the HTML file, it works. I am sure that the src link I have given in the HTML is correct. I have checked it multiple times. I have both my linked .js files in the same folder as my HTML file.
This is the index.html file:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Radar chart</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="RadarChart.js"></script>
<style>
body {
overflow: hidden;
margin: 0;
font-size: 14px;
font-family: "Helvetica Neue", Helvetica;
}
#chart {
position: absolute;
top: 50px;
left: 100px;
}
</style>
</head>
<body>
<div id="body">
<div id="chart"></div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
The error I am getting is as follows:
file:///home/******/*****/Tempelates/Test/script.js Failed to load resource: net::ERR_FILE_NOT_FOUND
I am using Linux. I have already looked at the following questions, but they could not help me.
Javascript files not working when linked, but work internally?
javascript file not working when linked from HTML
Javascript not working with HTML external link
I have been breaking my head over this. Help would be much appreciated. Thanks.
EDIT The code works fine in Windows but not in linux. I am even more confused now.