简体   繁体   中英

Prevent javascript from being cached in browser

I'm currently working on a webapp and the Javascript is revised fairly often. However, the changes don't occur until the browser cache is refreshed manually. Is there a way to implement cache-refreshing automatically through code for Chrome? Thanks.

You can put something like ?2352352 at the end of your JS file. So something like

<script src='myfile.js?20457207'></script>

Where the number randomizes, forcing the browser to think it's a different file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM