d586
d586

Reputation: 257

Javascript webpage doesn't work on localhost, but OK as file:///

but... file:///home/me/public_html/path/index.html everything works fine...

I'm trying to get a javascript page to run locally. (Using Ubuntu 14.04 and Apache)

When I open the file file:///home/me/public_html/path/to/index.html directory from file manager the webpage javascript runs fine all OK. (by double clicking the index.html file)

When I open it in chrome/firefox using localhost/~me/path/to/index.html only the html is rendered - the javascript doesn't run.

What have I missed or have failed to account for?

The js source files look like this:

<script src="libraries/jquery-1.9.0.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="libraries/prettify/prettify.js"></script>
<script src="libraries/tinycolor.js"></script>

[Solved] it was the subdirectory permissions... they were drwx------and should have been drwxr-xr-x - localhost works now.

Upvotes: 0

Views: 357

Answers (1)

m4n0
m4n0

Reputation: 32255

Install FireBug in Firefox and view the Console tab. If you found any Network Error, then there is a problem for your Apache to perform requests.

When I faced the same problem, it was the issue of my WAMP stack not able to perform requests due to installation of Bitnami Stacks which were interfering with the Apache of WAMP.

Upvotes: 1

Related Questions