我有一个继续使用http://www.imvu-e.com/products/hpv/download/HPV.js
缓存版本的书签。我希望它永远不会缓存它并始终重新加载它。
这是我用来保存书签的超链接(用户拖动到安装它的浏览器工具栏):
<a href="javascript:(function(){
c = document.createElement("script");
c.type = "text/javascript";
c.src = "http://www.imvu-e.com/products/hpv/download/HPV.js";
c.onload = c.onreadystatechange = function() {
if ( ! (d = this.readyState) || d == "loaded" || d == "complete"){
document.documentElement.childNodes[0].removeChild(c);
version='beta';
}
};
document.documentElement.childNodes[0].appendChild(c);
})();">Run HPV</a>
答案 0 :(得分:17)
在网址的末尾添加一个无用的查询字符串:
c.src = "http://www.imvu-e.com/products/hpv/download/HPV.js?" + (new Date).getTime();
答案 1 :(得分:0)
使用jQuery的getScript而不是脚本标记并更改源
names = ["john", "mike", "soniya"]
# Use a list comprehension to create the objects and put them in a list
employees = [employee(name) for name in names]
for employee in employees:
employee.display()
答案 2 :(得分:0)
纯JS解决方案:
<script>
var scr = document.createElement("script");
scr.src = "http://example.com/cool.js" + "?ts=" + new Date().getTime();
document.getElementsByTagName("head")[0].appendChild(scr);
</script>