Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9246585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:31:32+00:00 2026-06-18T09:31:32+00:00

I was wondering why the boilerplate from http://html5boilerplate.com/ declare jQuery after web content? Is

  • 0

I was wondering why the boilerplate from http://html5boilerplate.com/ declare jQuery after web content? Is there are a good reason for this?

This is a snippet of the code…

  <!-- Add your site or application content here -->
    <p>Hello world! This is HTML5 Boilerplate.</p>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.0.min.js"><\/script>')</script>
    <script src="js/plugins.js"></script>
    <script src="js/main.js"></script>

P.S. what does window.jQuery || part do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:31:33+00:00Added an answer on June 18, 2026 at 9:31 am

    It checks if the CDN copy loaded correctly. If not, it loads a local copy.


    When jQuery runs on the page, it creates a global jQuery variable. This can also be accessed as a property of the global object: window.jQuery. If jQuery hasn’t run, window.jQuery will be undefined.

    The || is a shorthand version of the following:

    if ( window.jQuery == undefined ) {
        document.write('<script src="js/vendor/jquery-1.9.0.min.js"><\/script>');
    }
    

    This way, if Google’s CDN is down (or if the browser cannot access ajax.googleapis.com) your site doesn’t break. Instead, an identical copy of jQuery will be served from your domain.


    The reason it’s at the bottom is because that’s what Yahoo’s performance guide recommends:

    The problem caused by scripts is that they block parallel downloads. The HTTP/1.1 specification suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won’t start any other downloads, even on different hostnames.

    […]

    If a script can be deferred, it can also be moved to the bottom of the page. That will make your web pages load faster.

    For more info on this, refer to Steve Souders’ excellent article on this topic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Wondering what the best / good way of doing this would be in jQuery.
Wondering if there is any way to get the lambda expressions that result from
I've started using HTML5, starting from the HTML5 Boilerplate . This includes modernizr, which
Wondering if there's any jquery library/plugin that can easily perform the following. At main
Wondering is there a function in javascript without jquery or any framework that allows
Wondering if there is tool to assist this kind of refactoring.
I've discovered this idiom recently, and I am wondering if there is something I
I am using the backbone-boilerplate, which you can find here . I was wondering
Wondering if anyone can suggest a good file replication tool that will replicate across
I'm tooling around with Django and I'm wondering if there is a simple way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.