Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a problem with JavaScript under Ubuntu, that drives me crazy.

I'm using Gedit for my web sites since I'm an Ubuntu user. When I start a new website I create (usually with the gnome terminal) folder structure, and I copy the files I need into them.
The next step is creating an index.html where I build the design and basic JavaScript functionality. JavaScript is stored in a sub-folder of the project and when i try to load one using the tag in the header, my whole page body disappears. If the source contains a script tag with its own body, and its not the first its code wont run.

I've tried to solve the problem by setting chmod to 777 with sudo chmod -R 777 . but nothing changed.
CSS is loading correctly, but JS isn't.

I'm using the newest version of apache, no mod_rewrite stuff, but i get the same problem when I run the html from file (file:///...)

Do anyone know how to solve this problem?

share|improve this question
No need for "777", also it's a security problem. If your work is tested through a web server, it's enough if only the user can read (and nor write, nor executable) your files the webserver run with. You can check the log of your webserver if file is requested at all which contain your javascript code. Also usually browsers has ability to run some debug/developer tools, so you can check out what's going on. – LGB Feb 16 '11 at 12:41

Neither apache nor the browser need a javascript file to be executable. The apache user (www-data) must be able to read the files and execute the directory they are in. Usually the group or user would be set to www-data, or "other" is given read permissions. Check /var/log/apache2/error_log for file access errors.

However from the symptoms you describe it's most likely a problem with your javascript code. There's probably an error in which is stopping subsequent scripts from running.

Otherwise we'd need to know what browser are you using and if you have problems on other sites.

share|improve this answer

The issue may be with

file. Just change the alias in this line
Alias /javascript /usr/share/javascript/

I had a issue that not able to load javascript folder in ubuntu for my local projects. I changed the alias name, it worked for me.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.