General developer forum

Problem with javascript-static.js

Picture of Andrew Nicols
Re: Problem with javascript-static.js
Core developersMoodle HQParticularly helpful MoodlersPlugin developersTesters

Try clearing your cache. The path is changed for this static file to improve cacheability. javascript.php ensures that various headers are set to try and ensure that the browser caches the file, and is designed such that subsequent calls for the same file where the browser provides a Last-Modified header just result in a 304 not changed. javascript.php also minifies the files on the fly. The timestamp is to ensure that when you upgrade Moodle, the timestamp is reset, thus changing the URL, and a browser will re-request a different file.

If you clear your cache, this will remove the existing server cache of the minified file, reset the timestamp in the URL, and this should mean that you get the file served. Most likely, something has caused the cache to be incorrect somehow - this may happen if your storage is flaky for example, or something odd happened the first time the file was requested and a dodgy copy was stored. This shouldn't happen, so if know the cause, it may be worth raising an issue so that we can prevent similar things happening again.


Average of ratings: -
Picture of Oren Bochman
Re: Problem with javascript-static.js

Thanks for the support

  • I was getting a 404 error.
  • Clearing the cache did not help.

I was not able to fix this even after reintsalling and upgrading - so I eneded up scrapping the virtual machine and reinstalling lamp+moodle.

Now I no longer have this problem.

Average of ratings: -
Picture of Adam F
Odp: Re: Problem with javascript-static.js


I have to bump this one.

I have the same problem - 404 on fetching javascript-static.js.

I tried to do purge-caches by console:

php admin/cli/purge_caches.php

but no luck:

Fatal error: $CFG->dataroot is not configured properly, directory does not exist or is not accessible! Exiting.

Theme and Css downloads ok the same for lang package in www app so it doesn't looks like bad $CFG->data root case.

Any help?

Average of ratings: -
Picture of Adam F
Odp: Re: Problem with javascript-static.js

My problem looks the same as this but environment is different:

Moodle 2.7.2

Idea Web Server (compatible with Apache)

Also I can't to disabled 'Use slash' option because panel do not want to work without javascript...



I installed fresh Moodle on local server went to server->HTTP section and copy link to it. Than I add my server address and went to this location. After turning off 'Use slash' everything back to normal.

Average of ratings: -