Related Tags:
JQuery JQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. Learn More, JavaScript Javascript is an object-oriented computer programming language commonly used to create interactive effects within web browsers. Learn More, ASP.NET MVC The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly. Learn More, Bundling and Minification Bundling: It's a simple logical group of files that could be referenced by unique name and being loaded with one HTTP requestor. Minification: It's a process of removing unnecessary whitespace, line break and comments from code to reduce its size thereby improving load times. Learn More,

How to asynchronously load some of my javascript files while using MVC 4 bundling and minification ?

Description:In my asp.net mvc 4 project there are some independent javascript files, i want to load them asynchronously for the site's performance aspect.
So I have following two question regarding this,
1) how to load some of my bundled js files asynchronously ?
2)Does it effect my site's performance as well ?

Posted by: | Posted on: Oct 20, 2017

1 answers

Replies

2

You can simply load your bundled js files asynchronously by using the Scripts.RenderFormat method as shown.

Scripts.RenderFormat(@"<script src=""{0}"" async></script>", "~/bundles/jquery")

Regarding your second question it has very minor impact on site's performance depending upon the bundle file size.

Replied by: | Replied on: Sep 12, 2018



Reply
×

Code block Hyperlink bold Quotes block Upload Images

Preview