通过重新加载页面或重新加载脚本/外部资源来修复Web应用程序错误
假设我刚刚在 Web 应用程序中发现了一个涉及 javascript 工作流程的错误。大多数时候我会修复错误并重新加载页面。不幸的是,这是一个一直重新加载页面的耗时过程。还有其他人通过重新加载更新的 Javascript / CSS 而不重新加载页面来节省时间吗?有没有任何工具可以帮助简化此操作。
我知道并非所有错误都可以通过重新加载脚本来修复,例如当错误出现在 window.onload 事件处理程序中时,但肯定可以修复很多运行时错误。
我还了解到,全局函数比在模块中编写的 JavaScript (function(){})() 更容易修复。
只是想看看 stackoverflow 社区对这个问题的看法。
谢谢
重新加载css文件怎么样?
Say I just found a bug involving javascript workflow in a web app. Most of the time I will fix the bug and reload the page. Unfortunately this is a time consuming process reloading the page all the time. Does anybody else save time by reloading updated Javascript / CSS without reloading the page. Are there any tools to help make this easy.
I understand that not all bugs can be fixed by just reloading the script, such as when the bug was in the window.onload event handler, but certainly alot of run time errors could be fixed.
I also understand that global functions are easier to hotfix then javascript written in modules (function(){})().
Just wanted to see what the stackoverflow community thought on the subject.
Thanks
How about reloading css files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想说,您最好调查一下根本问题,了解为什么您的页面需要这么长时间才能在开发环境中加载。
你可以简单地编写一些代码来使用ajax或一些类似的解决方案重新加载javascript,但这会很奇怪并且不标准,所以我真的不推荐它。此外,它不会模拟最终用户环境,因此不太适合测试目的。
我的建议:修复开发中网站加载缓慢的问题,然后鲁莽地重新加载。
I'd say it's better you look into the underlying issue as to why it's taking your page so long to load in your development environment.
You could trivially write some code to reload javascript using ajax, or some similar solution, but it would be quite strange and non-standard, so I would really not recommend it. Further, it wouldn't emulate the end-user environment, so it's not that good for testing purposes.
My recommendation: Fix the slow loading of your site in dev, and reload with reckless abandon.
Mozilla Venkman for Firefox 显然能够重新加载 JavaScript一页。
Mozilla Venkman for Firefox apparently has the ability to reload the JavaScript on a page.