为何js文件后面加一个参数?这样就会自动刷新本地js文件的缓存了么?_html/css_WEB-ITnose
<script type="text/javascript" src="http://xxx.com/v3.1.4/js/xxxx.min.js?d=201401201520"></script>
想问下本地文件缓存的有效期是如何设置的?
d后面这串数字是每次代码修改后自动生成的么?
每次项目构建,html中会生成新的串? 有什么构建工具支持这种功能呢?
回复讨论(解决方案)
咋加了个?d=201401201520就这么神奇。
咋加了个?d=201401201520就这么神奇。
解释下啊,亲
咋加了个?d=201401201520就这么神奇。
貌似不少是浏览器自动生成添加上去的,我用FF查看过,我的代码没加,后面不少URL多了这个参数。
当然手动加思想也很简单啊,生成过随机的字符串,直接加上去即可。+&a=xxxxxxxx
加了这个,相当于新的URL地址了,浏览器就会刷新缓存,否则,浏览器会认为,URL地址没变化,默认数据没变化,所以,不刷新缓存(你没变化,刷新干吗啊,不浪费我动作嘛)
这个不会是浏览器自动生成的,
一般用这个文件最后的修改时间戳,当然你用别的随机串也可以。
当然,这个也不会是手动来修改的。
你的系统应该有这个功能,
比如
用服务器端语言,比如php java等读取该js的最后修改日期,
然后动态生成这个<script></script>
<script></script>
这个不会是浏览器自动生成的,
一般用这个文件最后的修改时间戳,当然你用别的随机串也可以。
当然,这个也不会是手动来修改的。
你的系统应该有这个功能,
比如
用服务器端语言,比如php java等读取该js的最后修改日期,
然后动态生成这个<script></script>
<script></script>
如果用浏览器自动生成,用document.write加点时间数据,能生成后面的数字,但是每次都要下载js文件,浪费流量不是? 赶脚应该是build的时候生成的,甚至只有当检测到js文件发生修改,这个js?后面的数字才会发生变化,但是哪种构建工具可以做到这一点呢?
这个不会是浏览器自动生成的,
一般用这个文件最后的修改时间戳,当然你用别的随机串也可以。
当然,这个也不会是手动来修改的。
你的系统应该有这个功能,
比如
用服务器端语言,比如php java等读取该js的最后修改日期,
然后动态生成这个<script></script>
<script></script>
用服务器端语言,比如php java等读取该js的最后修改日期,
然后动态生成这个<script></script> 这个有现成的工具么?还是自己做这个功能?自己做还是挺麻烦的,要解析页面文件。。。
咋加了个?d=201401201520就这么神奇。
貌似不少是浏览器自动生成添加上去的,我用FF查看过,我的代码没加,后面不少URL多了这个参数。
当然手动加思想也很简单啊,生成过随机的字符串,直接加上去即可。+&a=xxxxxxxx
加了这个,相当于新的URL地址了,浏览器就会刷新缓存,否则,浏览器会认为,URL地址没变化,默认数据没变化,所以,不刷新缓存(你没变化,刷新干吗啊,不浪费我动作嘛)
一个js文件的缓存时间一般有多长?如何设置呢?
你在后面加了参数之后,虽然访问的是同一个文件,但是浏览器会认为这是一个新的地址,所以会重新访问一遍。
难道不是传一个参数让js执行?
难道不是传一个参数让js执行?
只是为了刷新存储吧?
这个不会是浏览器自动生成的,
一般用这个文件最后的修改时间戳,当然你用别的随机串也可以。
当然,这个也不会是手动来修改的。
你的系统应该有这个功能,
比如
用服务器端语言,比如php java等读取该js的最后修改日期,
然后动态生成这个<script></script>
<script></script>
亲用过grunt么?也许grunt可以做到这一点

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Is the F5 key not working properly on your Windows 11/10 PC? The F5 key is typically used to refresh the desktop or explorer or reload a web page. However, some of our readers have reported that the F5 key is refreshing their computers and not working properly. How to enable F5 refresh in Windows 11? To refresh your Windows PC, just press the F5 key. On some laptops or desktops, you may need to press the Fn+F5 key combination to complete the refresh operation. Why doesn't F5 refresh work? If pressing the F5 key fails to refresh your computer or you are experiencing issues on Windows 11/10, it may be due to the function keys being locked. Other potential causes include the keyboard or F5 key

When deleting or decompressing a folder on your computer, sometimes a prompt dialog box "Error 0x80004005: Unspecified Error" will pop up. How should you solve this situation? There are actually many reasons why the error code 0x80004005 is prompted, but most of them are caused by viruses. We can re-register the dll to solve the problem. Below, the editor will explain to you the experience of handling the 0x80004005 error code. Some users are prompted with error code 0X80004005 when using their computers. The 0x80004005 error is mainly caused by the computer not correctly registering certain dynamic link library files, or by a firewall that does not allow HTTPS connections between the computer and the Internet. So how about

Quark Netdisk and Baidu Netdisk are currently the most commonly used Netdisk software for storing files. If you want to save the files in Quark Netdisk to Baidu Netdisk, how do you do it? In this issue, the editor has compiled the tutorial steps for transferring files from Quark Network Disk computer to Baidu Network Disk. Let’s take a look at how to operate it. How to save Quark network disk files to Baidu network disk? To transfer files from Quark Network Disk to Baidu Network Disk, you first need to download the required files from Quark Network Disk, then select the target folder in the Baidu Network Disk client and open it. Then, drag and drop the files downloaded from Quark Cloud Disk into the folder opened by the Baidu Cloud Disk client, or use the upload function to add the files to Baidu Cloud Disk. Make sure to check whether the file was successfully transferred in Baidu Cloud Disk after the upload is completed. That's it

A file path is a string used by the operating system to identify and locate a file or folder. In file paths, there are two common symbols separating paths, namely forward slash (/) and backslash (). These two symbols have different uses and meanings in different operating systems. The forward slash (/) is a commonly used path separator in Unix and Linux systems. On these systems, file paths start from the root directory (/) and are separated by forward slashes between each directory. For example, the path /home/user/Docume

Recently, many netizens have asked the editor, what is the file hiberfil.sys? Can hiberfil.sys take up a lot of C drive space and be deleted? The editor can tell you that the hiberfil.sys file can be deleted. Let’s take a look at the details below. hiberfil.sys is a hidden file in the Windows system and also a system hibernation file. It is usually stored in the root directory of the C drive, and its size is equivalent to the size of the system's installed memory. This file is used when the computer is hibernated and contains the memory data of the current system so that it can be quickly restored to the previous state during recovery. Since its size is equal to the memory capacity, it may take up a larger amount of hard drive space. hiber

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

C++ parameter type safety checking ensures that functions only accept values of expected types through compile-time checks, run-time checks, and static assertions, preventing unexpected behavior and program crashes: Compile-time type checking: The compiler checks type compatibility. Runtime type checking: Use dynamic_cast to check type compatibility, and throw an exception if there is no match. Static assertion: Assert type conditions at compile time.

Detailed explanation of the role of .ibd files in MySQL and related precautions MySQL is a popular relational database management system, and the data in the database is stored in different files. Among them, the .ibd file is a data file in the InnoDB storage engine, used to store data and indexes in tables. This article will provide a detailed analysis of the role of the .ibd file in MySQL and provide relevant code examples to help readers better understand. 1. The role of .ibd files: storing data: .ibd files are InnoDB storage
