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.

"async" atribute loading javascript

Discussion in 'JavaScript' started by postcd, May 1, 2014.

  1. #1
    postcd, May 1, 2014 IP
  2. hdewantara

    hdewantara Active Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Hi Postcd.
    If I'm not mistaken, that means to put that jQuery CDN to the end of your HTML content block... so it would be the last to be rendered. So putting it just before the closing </body> tag will make Google happy, I think:)
    hdewantara, May 1, 2014 IP
    deathshadow likes this.
  3. deathshadow

    deathshadow Illustrious Member

    Likes Received:
    Best Answers:
    Trophy Points:
    Yeah, that Async attribute really doesn't do **** in most browsers anyways, and anyone telling you otherwise doesn't know ****.

    @hdewantara has it right in that you should move it to the end of the document, or at the very least into BODY. Any GOOD scripting should be attaching itself after that point -- but beware that you might have some poorly written scripts (pretty much a given once that steaming pile of halfwit bloated maggot ridden garbage known as jQuery is in the picture) that will require jQuery to load before they can run -- in which case either get rid of that stupid malfing jQuery nonsense, or move it into the start of BODY.

    Also, beware that moving it CAN result in slower pageloads -- the opposite of what Google tells you. It's good practice to move it, but don't trust it. Try it both ways, and test yourself using the waterfalls in tools like FireBug or Dragonfly. A LOT of what automated tools like pageSpeed tells you can actually be the opposite of what you need to do, as like a lot of automated tools they try to be a "one size fits all" solution -- and when you do that you end up jack of all trades, but master of none.

    In fact, there are a few things it says that are outright bullshit if you have a well written site; but to their credit most websites aren't well written.
    deathshadow, May 1, 2014 IP