1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Javascript not loading fast enough - slows overall page load too much

Discussion in 'JavaScript' started by Andre Glegg, Aug 21, 2012.

  1. #1
    On my site... www.lolfunstuff.com the all the Javascript I have seem to be loading a while after the page loads.. it seems very slow to me.. I'm not sure if this is normal, any idea how I can fix this?

    I'm using wordpress along with a custom theme and plugins I created.
     
    Andre Glegg, Aug 21, 2012 IP
  2. shofstetter

    shofstetter Well-Known Member

    Messages:
    178
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    120
    #2
    Most scripts need to execute after the page has loaded so the scripts can access the dom. If there is a large delay it might be caused by errors in the scripts, or network latency. You can improve download speed, by compressing the scripts. http://jscompress.com/

    Errors will sometimes stop scripts outright, and you can check for those by using firebug firefox, or JavaScript console in the developer tools in chrome.
     
    shofstetter, Aug 25, 2012 IP
  3. KsNitro

    KsNitro Greenhorn

    Messages:
    60
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    20
    #3
    Your page has very heavy javascript usage. The biggest problem from a glance is you have included many scripts multiple times. You probably have blocking code on that page so your content can't load until the scripts have finished.

    You may want to consider a different page structure altogether. There are red flags all over that page. If that isn't feasible for you, try combining all the javascript into a single file as already noted. Make all your javascript a single call to your page. If the code is slow, include the javascript at the bottom of your page next to the </body> tag.
     
    KsNitro, Aug 29, 2012 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #4
    Endless pointless javascript for nothing, based on fat bloated pointless libraries like jquery, with static CSS inlined in the markup, using iframes and a host of other "Driving with the parking brake on" -- and you wonder why it's slow?

    Even the markup is bad -- 28k of markup and a host of pointless wrappers to deliver less than 1k of plaintext and 16 content images?!? Easily two or three times as much code as needed, and that would be WITH adding whitespace/formatting back into it (I still say whitespace stripping is for hiding crap code, not saving bandwidth) -- mate this to a whopping 1.1 megabytes of data in *SHOCK* 107 separate files (doing the job of a dozen files) and it's no surprise it takes >30 seconds to even load here -- handshaking ALONE that 100+ separate files can cause anywhere from 5 seconds to 2 minutes in loading delays. (Which is where tools like Pingdom are completely inaccurate, their ping times to other servers do NOT represent the 'real world')

    Though your server is also not responding with proper headings, so my normal page analysis tool I use can't even analyze it.

    Entirely what one expects from slapping together a bunch of off the shelf components together any-old-way, and why I do not advocate that approach to site-building if you care about accessibility, usability, functionality or sustainability.
     
    deathshadow, Sep 1, 2012 IP