在我之前从事的项目中,我注意到 javascript 文件包含在脚本管理器中,如下所示:
<asp:ScriptReference Path="~/Scripts/jquery-1.7.1.min.js" />
<asp:ScriptReference Path="~/Scripts/site.js" />
我已经尝试搜索脚本引用和常规 <script src="/>
之间的区别在 asp 页面中,但似乎找不到任何信息。使用脚本引用有优势吗?
谢谢
最佳答案
当您使用 ScriptManager 时,可以创建单个复合脚本以减少 ASP.NET 的浏览器请求数。
您也可以引用ScriptReference Class
此外,ScriptManager 的 about
部分提供了有关的更多详细信息
它:
ScriptManager is an ASP.NET control that manages ASP.NET Ajax script libraries. The ScriptManager performs the following functions.
- Enables partial page rendering
- Eanbles client side script access to web services
- Enables use of authenication and profile services from the client
Only one ScriptManager can be allowed per page. For scenarios where a second ScriptManager reference is required, such as within an usercontrol, the ScriptManagerProxy control should be used.
关于javascript - ScriptManager 脚本引用有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30650730/