Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load JQuery faster?

I am having aspx which has jquery. Due to delay in loading jquery I am facing some style issues. Please can anyone tell me how to load jquery very fast.

like image 677
user1215950 Avatar asked Dec 29 '25 11:12

user1215950


2 Answers

I read a Blog post by Sam Saffron from Stackoverflow on this topic today. I didnt try out the authors tipps yet though so I cant confirm.

http://samsaffron.com/archive/2012/02/17/stop-paying-your-jquery-tax

the tl;dr; is to push jquery to the footer of the page and define a $.ready function in the header which captures all the scripts that couldnt yet be run because jquery didnt load until the actual $.ready function is loaded.

like image 76
joidegn Avatar answered Jan 01 '26 00:01

joidegn


LABjs is a script loader that allows you to load scripts in a dependancy order, so you can start by loading jQuery and not block other scripts from loading. You would only block those scripts that are jQuery dependant. This may help you increase the page load speed.

LABjs (Loading And Blocking JavaScript) is an open-source (MIT license) project supported by Getify Solutions. The core purpose of LABjs is to be an all-purpose, on-demand JavaScript loader, capable of loading any JavaScript resource, from any location, into any page, at any time. Loading your scripts with LABjs reduces resource blocking during page-load, which is an easy and effective way to optimize your site's performance.

like image 34
Neil Knight Avatar answered Jan 01 '26 01:01

Neil Knight



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!