开发者

Why drupal adds version number to js path?

开发者 https://www.devze.com 2023-04-08 05:57 出处:网络
Why the dr开发者_Python百科upal adds the version number (like ?v=XXX) into the .js libraries? For example:

Why the dr开发者_Python百科upal adds the version number (like ?v=XXX) into the .js libraries? For example:

<script type="text/javascript" src="http://localhost/misc/jquery.js?v=1.4.4"></script>

And what means strange text at the end of path to .css files (after the '?' sign):

@import url("http://localhost/modules/system/system.menus.css?lrrru5");


About dummy text (about versions Peter point to link), let's look comments on common.inc file in drupal/includes folder:

function drupal_get_js($scope = 'header', $javascript = NULL) {
  ..
  // A dummy query-string is added to filenames, to gain control over
  // browser-caching. The string changes on every update or full cache
  // flush, forcing browsers to load a new copy of the files, as the
  // URL changed. Files that should not be cached (see drupal_add_js())
  // get time() as query-string instead, to enforce reload on every
  // page request.
  $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
  ..
}

function drupal_get_css($css = NULL) {
  ..
  // A dummy query-string is added to filenames, to gain control over
  // browser-caching. The string changes on every update or full cache
  // flush, forcing browsers to load a new copy of the files, as the
  // URL changed.
  $query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
common.inc
  ..
}


Like they say here : http://drupal.org/node/82831 : it was not simple before to track the jquery version.

Since you can use jquery functionality in the drupal page, you have to know which version you are using to know exactly which functionality is present.

0

精彩评论

暂无评论...
验证码 换一张
取 消