Sunday 15 March 2015

javascript - Loading jquery in MVC 4.0 master page -



javascript - Loading jquery in MVC 4.0 master page -

in <head> section of _layout.cshtml(master page) file have next reference minified jquery:

<script src="~/scripts/jquery-1.8.2.min.js" type="text/javascript"></script>

after adding line can utilize jquery in of pages reference master page great.what know how loading of jquery file performed?will done everytime page loaded or 1 time when first page of website loaded in browser?

the file loaded in browsers' cache upon first load. every subsequent request read cache cut down bandwidth requirements , improve speed.

if want improve performance, can load jquery.js global cdn, such google, has advantage of beingness fast, , due it's widespread utilize it's highly has jquery in cache location.

i suggest using newer version of jquery 1.8.2 quite old now. if need legacy browser back upwards (ie9 , lower), utilize 1.11:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

otherwise can utilize smaller , more efficient 2.x:

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

javascript c# jquery asp.net asp.net-mvc-4

No comments:

Post a Comment