Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Clearing all caches in Drupal should have the result that no browser uses old cached javascript files. The Drupal way of doing this is adding a cache busting token to the url of the javascript file, as a querystring. Drupal provides a variable for this. It can be retrieved like this: variable_get('css_js_query_string', '')
So, for example, in ckeditor.lib.inc, you should replace this code
if (!empty($conf['theme_config_js']) && $conf['theme_config_js'] == 't' && file_exists($themepath . 'ckeditor.config.js')) {
$ckeditor_config_path = $host . $themepath . 'ckeditor.config.js?' . @filemtime($themepath . 'ckeditor.config.js');
}
else {
$ckeditor_config_path = $module_drupal_path . "/ckeditor.config.js?" . @filemtime($module_drupal_path . "/ckeditor.config.js");
}
with this:
if (!empty($conf['theme_config_js']) && $conf['theme_config_js'] == 't' && file_exists($themepath . 'ckeditor.config.js')) {
$ckeditor_config_path = $host . $themepath . 'ckeditor.config.js?' . variable_get('css_js_query_string', '');
}
else {
$ckeditor_config_path = $module_drupal_path . "/ckeditor.config.js?" . variable_get('css_js_query_string', '');
}
Comments
Comment #1
jcisio CreditAttribution: jcisio commentedI think it is generally better to use drupal_add_js as having pointed out in #1966798: Replace usage of ckeditor_path('url') with drupal_add_js to avoid messing with Drupal internals.
Also, it does not solve the broader problem: everytime you modify your JS, or update the library, the cache is not flushed. As a result: #2147155: Icons are broken with 4.3 library.
Comment #2
rosell.dk CreditAttribution: rosell.dk commentedOk, sounds sensible. I guess the issue I'm actually concerned with is that a Drupal "flush all caches" have no effect. Using drupal_add_js() to include javascript files as suggested in #1 will fix that issue