将 jquery 和 jquery ui 引用添加到母版页脚本管理器
一个幼稚的问题,我有一个使用 jquery 的 ASP.NET Intranet 应用程序,而不是在每个页面上引用 jquery,我决定将其放在脚本管理器 scriptReference 标记内的母版页上。请注意,并非我的应用程序的所有页面都需要 jquery,所以这样做是否明智,否则会影响性能, 任何想法
one juvenile question , i am having a asp.net intranet application which is using jquery, instead of ref jquery to every page, i decided it to put it on the master page inside the script manager scriptReference tag. note not all pages of my application requires jquery, so is it a wise thing to do, or it will affect the performance,
any ideas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这不是一个坏主意。它不会对性能产生太大影响,因为 JQuery 代码应该由客户端缓存。这意味着您知道它始终存在,并且在添加新页面时无需考虑它。
It's not a bad idea. It won't affect performance greatly because the JQuery code should be cached by the client. It means you know it's always there and you don't have to think about it when you're adding new pages.
只要库的 URL 保持一致,用户的浏览器就应该在第一次加载时对其进行缓存。包含它所带来的任何性能影响充其量也将是最小的。
如果可能的话,进一步的改进可能是简单地引用托管 jQuery 的众多 CDN 之一。这基本上可以保证您的用户可以从一个网站或另一个网站获得一份缓存副本。
As long as the URL of the library remains consistent, your users' browsers should cache it the first time it is loaded. Any performance hits from having it included would then be minimal at best.
If possible, a further improvement might be to simply reference one of the many CDNs which host jQuery. This would essentially guarantee that your users would have a cached copy from one website or another.