Take the 2-minute tour ×

When I delete "Page requisites" cache, my 2 Javascript files that I use for my home page image rotator get deleted. Here is how I'm adding the javascript for those 2 files into a WYSIWYG editor with PHP code enabled:

Some html here for the rotator......

Then I also have some JS code added to the home page only using the js Injector .

Any ideas why this is happening?


share|improve this question
Looks like your code got deleted. Indent all code by four spaces to have it formatted like source code. –  Mike Crittenden Mar 1 '10 at 16:59
Thanks, I added it again. –  EricP Mar 1 '10 at 17:01

1 Answer 1

up vote 4 down vote accepted

You shouldn't have permanent js files located in your files folder. Either they should be in your theme or a module that uses them. The files folder is meant for uploaded files and other files that Drupal creates on the fly.

The reason to your problem is probably that Drupal has write access to the folder where you have placed the files, and it cleans out in it, since it's only used for compressions. You should think twice about which files you let drupal write to. Letting Drupal have write access to a script file you use, is an added security risk.

Generally, you don't want to let Drupal write to js or php files. This is because if a cracker would be able to get Drupal to write to those files, he would be able to more or less gain control over your entire site. This is also why the compressed js files that drupal uses has a long and random name.

So try moving those files into your theme and see if that doesn't fix it. If you want to link to them you can do

drupal_add_js(drupal_get_path('theme', 'name_of_your_theme') . 'path/to/file.js');
share|improve this answer
Perfect. Thank you! –  EricP Mar 2 '10 at 14:03

Your Answer


