简体   繁体   English

在不刷新页面的情况下刷新 Javascript 文件。

[英]Refrashing the Javascript File without page refresh.

I am working on a very complex web site which is wizard based and have many JavaScript files included.我正在开发一个非常复杂的网站,该网站基于向导并包含许多 JavaScript 文件。

Now problem is if I pass through many step and at some later stage I find a JavaScript problem, as I fix it I have to load the page again and as I load the page again the Wizard will be started from step one again.现在的问题是,如果我通过很多步骤,在稍后的某个阶段我发现了一个 JavaScript 问题,当我修复它时,我必须再次加载页面,当我再次加载页面时,向导将再次从第一步开始。

What I want is if I make JavaScript change in a file, there should be a possibility to refresh the JavaScript file through Firebug or something like it.我想要的是,如果我在文件中更改 JavaScript,应该有可能通过 Firebug 或类似的东西刷新 JavaScript 文件。

Thanks a lot.非常感谢。

No, not really.不,不是真的。 You could try to change the <script> 's src attribute to something like /your/script.js?timestamp=1234567890 , but this doesn't give a reliable guarantee that the script will be loaded again.您可以尝试将<script>src属性更改为/your/script.js?timestamp=1234567890类的/your/script.js?timestamp=1234567890 ,但这并不能可靠地保证脚本将再次加载。

You could add another script element into the DOM, but then you'd have two very similar scripts loaded at the same time, which may be problematic.您可以将另一个script元素添加到 DOM 中,但是您将同时加载两个非常相似的脚本,这可能会出现问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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