当前位置: 首页 > 图文教程 > 网络编程 > Javascript > js或css文件后面跟参数的原因说明

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 js或css文件后面跟参数的原因说明


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 351 ::
收藏到网摘: n/a

经常看到不少导航网站测样式或js文件后面加了一些参数,主要是一你为一些并不经常更新的页面重新加载新修改的文件。 经常遇到页面里加载的js与css文件带有参数,比如:
<script type="text/javascript" src="jb51.js?version=1.2.6"></script><link rel='stylesheet' href='base.css?version=2.3.3' type='text/css' />
使用参数有两种可能,
脚本并不存在,而是服务端动态生成的,因此带了个版本号,以示区别。
客户端会缓存这些css或js文件,因此每次升级了js或css文件后,改变版本号,客户端浏览器就会重新下载新的js或css文件
第二种情况最多,也可能两种同时存在。
版本号,可以是一个随机数,也可以是一个递增的值,大版本小版本的方式,或者根据脚本的生成时间书写,比如 20080727182553 就是精确到了生成脚本的秒,而 2.3.3 就是大版本小版本的方式。