English 中文(简体)
我如何强迫在浏览器中恢复javascript文档? [复制]
原标题:How do I force the refresh of javascript files in a browser? [duplicate]
  • 时间:2011-11-22 16:55:16
  •  标签:
  • javascript

我曾用一幅“JQuery”、“KnockoutJS”和其他“Javad”的字眼,为我正在建造的网络 app子。 多数联合材料在自己的单冰箱中消失。 我面临的问题是,浏览器在我推动变革者在获得更新档案之前必须几次复读时,就把这些文件整理起来。 最近,我对通过一些数据的方式作了重大改变,档案的细列版本造成了一些错误,更糟糕的是,一些数据被删除。

人民如何处理这一问题? 是否有办法强制更新档案?

最佳回答

不同的发展中国家做的是不同的事。 官方途径是玩笑和使用吉大港山区头盔。 谷歌用于“领导和教学问题”,你应该以自己的方式继续工作。

However some browsers just ignore you so if im developing in a live environment, i use version numbers to ensure everyone gets the latest file. So you might call your original "something.js?v=1.0". Make a small change then change it to "?v=1.1".. you get the idea. Because the link is different, it should completely ignore caching in most cases.

我倾向于使用两种方法,只要尽可能确保。

问题回答

我知道强迫所有浏览器忽略切身之处的唯一办法是在文字标签上添加某种独特的识别标志。

你们可以做的一件事是,通过GET param增加一个时间档或版本号码,向服务器赢得任何东西,或者如果可行的话,仅改变文字本身的名称:

<script type="text/javascript" src="myscript.js?version=2.0"></script>
<script type="text/javascript" src="myscript.js?ts=9342038423048"></script>
<script type="text/javascript" src="myscript.2.0.js"></script>

如果对联合材料档案进行了重大修改,尽管大多数浏览器应当足够精彩,能够打上新的复印件......如果你能够使用服务器(Cache-expire等),你也可以打上你的回复头盔。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签