0

I've installed CentOS and LAMP on an old desktop at home to practice system administration and webadmining, but I'm running into a strange problem.

I have a webpage that's no more than:

<!DOCTYPE html>
<html
    <head>
        <script type="text/javascript" src="test.js"></script>
    </head>
    <body>
    </body>
</html>

The chrome console is telling me that the request for test.js is failing. When I right click the link it gives and open it in a new tab, it correctly shows.

Is there a setting in apache that I need to set for this to work?

edit: Only thing in the logs is about the favicon

edit:

Some additional details: I'm accessing via the local ip of the machine, external script and stylesheet requests work, and all the files are in the same directory.

edit: Using fiddler, it looks like chrome isn't even sending out the request for the files.

edit: The response headers for the webpage include "Connection: close"

4

1 回答 1

0

确保包含该 HTML 代码的文件和 test.js 位于同一目录中。我怀疑这就是问题所在。

如果您双击系统上的文件,它不会通过 apache 打开。如果您通过 则打开 html http://localhost/test.html chrome 将搜索到 test.js 中 http://localhost/test.js

于 2012-12-11T23:04:03.580 回答