头文件中src / href属性结尾处的奇怪字符 [英] Weird characters at the end of src/href attributes in head tag

查看:109
本文介绍了头文件中src / href属性结尾处的奇怪字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速问题:为什么drupal在 src href 属性的末尾添加字符链接脚本页面顶部的标签?我有这个:

Quick question : Why is drupal adding characters at the end of the src or href attributes in the link and script tags in the head of the page ? I have this :

<link type="text/css" rel="stylesheet" media="all" href="/ste_thecle/modules/views/css/views.css?n" />

每个样式表和脚本加载都是一样的。我不知道为什么这样做,我想也许这就是为什么我的主题在IE中混乱的原因...

And it is the same for every stylesheet and script loaded. I can't figure out why it's doing that, and I think maybe it's the reason why my theme is all messed up in IE...

谢谢。 >

Thanks.

推荐答案

每次浏览器加载外部JavaScript文件时,浏览器将文件放在缓存中。
这样,第二次你将重新加载页面并尝试加载相同的外部文件,浏览器将从缓存中使用它。

Each time the browser loads an external JavaScript file, the browser put the file in its cache. This way, the second time you will reload the page and try to load the same external file, the browser will use it from the cache.

如果你更改JavaScript文件并尝试重新加载您的页面,更改将不会生效,因为浏览器将使用缓存文件。

If you make a change in the JavaScript file and try to reload your page, the changes will not take effect because the browser will use the cache file.

为了防止此行为,Drupal将在JavaScript文件的URL的末尾添加一个随机值。这样浏览器会将文件看作一个新的文件,不会在浏览器缓存中使用该文件。

To prevent this behavior, Drupal will add a random value at the end of the URL of the JavaScript file. This way the browser will see the file as a new file and will not use the file in the browser cache.

一个好的做法是在生产阶段删除这个功能该页面将加载更快。

A good practice is to remove this functionality in production stage so the page will load faster.

这篇关于头文件中src / href属性结尾处的奇怪字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆