Async loading of javascript files using MVC4 Bundling and HTML5 async attribute

后端 未结 1 736
闹比i
闹比i 2020-12-24 11:41

HTML5 has an async attribute for script files, to enable async loading.




        
相关标签:
1条回答
  • 2020-12-24 11:49

    If you upgrade to the 1.1-alpha1 release, you can just add the async attribute to the tag format either via:

    Scripts.DefaultTagFormat = @"<script src=""{0}"" async></script>"
    

    or passing it where you want the async tag

    Use following instead of Scripts.Render("~/bundles/jquery")

    Scripts.RenderFormat(@"<script src=""{0}"" async></script>", "~/bundles/jquery")
    
    0 讨论(0)
提交回复
热议问题