为什么drupal会将版本号(如?v = XXX)添加到.js库中? 例如:
<script type="text/javascript" src="http://localhost/misc/jquery.js?v=1.4.4"></script>
这意味着.css文件路径末尾的奇怪文本(在'?'符号后面):
@import url("http://localhost/modules/system/system.menus.css?lrrru5");
答案 0 :(得分:2)
关于虚拟文本(关于Peter指向链接的版本),让我们看看drupal / includes文件夹中common.inc文件的注释:
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
..
}
答案 1 :(得分:1)
就像他们在这里说的那样:http://drupal.org/node/82831:跟踪jquery版本之前并不简单。
由于您可以在drupal页面中使用jquery功能,因此您必须知道使用哪个版本来确切知道存在哪些功能。