jQuery CDN as A Named Module In RequireJS

If you want RequireJS to fetch jQuery from a CDN, you’ll need to tell it to do so using the “paths” config:

require.config({
paths: {
"jquery": "https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"
}
});

As I understand it, if you want to use the local file fallback code a la html5bp you’re out of luck. For those of you who don’t know, the local file fallback code allows you to load jQuery from your own domain if the CDN version fails to load. It looks like this:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.2.min.js"><\/script>')</script>

Arguably, if you’re using jQuery it is likely to be a global requirement rather than a requirement for one or two modules. The same sort of thing with BackboneJS. It might be better to place these global requirements in the HTML for your pages (before the RequireJS script) to save typing ‘jquery’ and ‘backbone’ in all your module definitions.

6,915 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. hey there and thank you for your info – I have certainly
    picked up something new from right here. I did however expertise some technical points using this site,
    since I experienced to reload the site a lot of times previous to I could get it to load correctly.
    I had been wondering if your web hosting is OK? Not that I am complaining, but sluggish loading instances times will often affect your placement
    in google and could damage your quality score if advertising and marketing with Adwords.

    Well I am adding this RSS to my email and could look out for a lot more of your respective intriguing
    content. Ensure that you update this again soon.

  2. Hey! I cоuld hɑve sworn I’vе bеen tο this blog beforе but ɑfter checking through ѕome of tһe post I realized it’s new to me.
    Nonetһeless, I’m ⅾefinitely happy Ι found it ɑnd I’ll bе book-marking аnd checking bacқ often!

  3. Howdy! I just wish to give you a huge thumbs up for your excellent info you have got right here on this post.
    I will be returning to your website for more soon.

  4. It’s a pity you don’t have a donate button! I’d
    without a doubt donate to this excellent blog!
    I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account.

    I look forward to brand new updates and will share this site with my
    Facebook group. Talk soon!

  5. Excellent post. I used to be checking continuously this blog and I’m inspired!
    Very helpful info specially the ultimate part :) I
    deal with such info much. I used to be seeking this certain information for a very lengthy time.

    Thanks and good luck.

  6. I am curious to find out what blog platform you have been working with?
    I’m having some small security issues with my latest website and I’d like to find something
    more risk-free. Do you have any recommendations?

  7. Does your website have a contact page? I’m having problems
    locating it but, I’d like to send you an email.

    I’ve got some ideas for your blog you might be interested in hearing.
    Either way, great blog and I look forward to seeing it improve over
    time.

  8. Hi there would you mind stating which blog platform you’re working with?
    I’m planning to start my own blog soon but
    I’m having a hard time deciding between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs and I’m looking for
    something completely unique. P.S Sorry for getting off-topic but I had to ask!

  9. This website really has all of the information I wanted concerning this subject and didn’t know
    who to ask.

  10. Nice weblog right here! Also your website so much up very fast!
    What host are you the use of? Can I am getting your affiliate hyperlink for your host?
    I desire my web site loaded up as fast as yours lol

  11. Hey there! I realize this is sort of off-topic but I needed to ask.
    Does building a well-established website like yours require a massive amount work?
    I am brand new to blogging however I do write in my diary
    on a daily basis. I’d like to start a blog so I will be able to
    share my experience and thoughts online. Please let me know
    if you have any kind of suggestions or tips for brand new aspiring bloggers.
    Appreciate it!

  12. An impressive share! I’ve just forwarded this onto a colleague who was doing
    a little homework on this. And he actually ordered me breakfast because I discovered it for him…

    lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanks for spending the time to talk about this subject here on your web site.

  13. Hey there! This is my first visit to your blog! We are a collection of volunteers and starting a new project in a community in the same niche.
    Your blog provided us useful information to work on. You have done a outstanding job!

  14. I have been browsing online more than 4 hours today, yet I never found any
    interesting article like yours. It is pretty worth enough for me.
    In my view, if all website owners and bloggers made
    good content as you did, the net will be a lot more useful than ever before.

  15. We are a group of volunteers and opening a new scheme in our community.
    Your web site offered us with valuable information to work on. You’ve done a formidable job
    and our entire community will be grateful to you.

  16. Hello I am so glad I found your site, I really found you by error, while I was looking on Aol for something
    else, Regardless I am here now and would just like to say thanks for a tremendous post and a all round interesting blog (I also love the theme/design), I don’t have time to go through it all at the moment but I have saved
    it and also added in your RSS feeds, so when I have time
    I will be back to read more, Please do keep up the fantastic b.

  17. My programmer is trying to convince me to move to .net from PHP.
    I have always disliked the idea because of the costs.

    But he’s tryiong none the less. I’ve been using WordPress on various websites for about a year and am worried about switching to
    another platform. I have heard very good things about blogengine.net.
    Is there a way I can transfer all my wordpress posts into it?
    Any help would be really appreciated!

  18. This is an insightful post! I just discovered the incredible products at Finessa Sales on [finessa-sales.us](https://finessa-sales.us). The variety of health products is impressive.
    What do you think about their offerings?

  19. For hottest news you have to visit world-wide-web and on internet
    I found this website as a finest site for
    newest updates.

  20. Hello, There’s no doubt that your site could
    be having browser compatibility problems. Whenever
    I take a look at your website in Safari, it looks fine
    but when opening in IE, it has some overlapping issues.

    I just wanted to provide you with a quick heads up! Besides that, great website!

  21. Hi there! Quick question that’s completely off topic.
    Do you know how to make your site mobile friendly?
    My site looks weird when viewing from my iphone 4. I’m trying
    to find a template or plugin that might be able to resolve
    this issue. If you have any suggestions, please share.

    Thanks!

  22. Hi! This post could not be written any better!
    Reading through this post reminds me of my previous room mate!
    He always kept chatting about this. I will forward this article to him.
    Pretty sure he will have a good read. Many thanks
    for sharing!

  23. Hi there it’s me, I am also visiting this site regularly,
    this site is actually good and the users are really
    sharing pleasant thoughts.

  24. Hi there! I realize this is sort of off-topic however
    I had to ask. Does running a weⅼl-established blog ⅼike үours take a lot of work?
    I’m brand new to operating а blog hoѡeѵer I do write in my
    journal on a daily basis. I’ɗ like to start a
    blog ѕo I can share mʏ personal experience and feelings online.

    Plеase lеt me know if yօu havе аny kind of suggestions օr tips foг neѡ aspiring blog
    owners. Thankyou!

  25. I’m amazed, I must say. Seldom do I come across a blog that’s
    both equally educative and engaging, and let me tell you, you have
    hit the nail on the head. The issue is something which not enough folks are speaking intelligently about.
    I’m very happy that I stumbled across this during my search for something concerning this.

  26. Looking for solutions to hormonal imbalances? Thyra Femme Balance USA offers a powerful solution designed specifically for women. Our specialized supplement contains natural compounds that support hormonal balance and overall well-being.

    Customers rave about positive changes in their mood, energy
    levels, and overall health after using Thyra Femme Balance.
    Don’t let hormonal fluctuations affect your life!

    Experience the benefits for yourself with Thyra Femme Balance USA.
    Learn more at thyrafemmebalance-usa.us to discover how our hormonal
    balance supplement can make a difference!

  27. Hello there! I know this is somewhat off topic but I was wondering if you knew where I could get a captcha plugin for my
    comment form? I’m using the same blog platform as yours and I’m
    having difficulty finding one? Thanks a lot!

  28. Kaizenaire.com curates Singapore’ѕ the majority օf interesting promotions and deals, makіng it the tօp site foг neighborhood shopping lovers.

    Singapore stands ρroud аѕ a shopping utopia, ԝherе deals stir up Singaporean passion.

    Exercising mindfulness meditation aids stressed ⲟut Singaporeans discover calm,
    аnd remember to remain updated on Singapore’s
    most recеnt promotions аnd shopping deals.

    Wong Hang ρrovides bespoke customizing solutions, treasured ƅy critical Singaporeans
    for tһeir custom matches ɑnd remarkable craftsmanship.

    SATS deals ԝith air travel аnd food services one, appreciated Ьy Singaporeans for tһeir іn-flight event
    catering аnd ground handling effectiveness mah.

    SIS Sugar sweetens ԝith fine-tuned sugars, loved fߋr baking fundamentals in Singaporean houses.

    Wah, numerous brands ѕia, check Kaizenaire.cⲟm usᥙally to
    snag thօѕe special price cuts lor.

    Alsо visit my blog … Kaizenaire.com Promotions

  29. Howdy, i read your blog from time to time and
    i own a similar one and i was just curious if you get a lot
    of spam comments? If so how do you reduce it, any plugin or anything you can suggest?
    I get so much lately it’s driving me insane so any help is very much
    appreciated.

  30. With havin so much written content do you ever run into any issues of plagorism or copyright infringement?
    My website has a lot of completely unique content I’ve either
    authored myself or outsourced but it looks like a lot
    of it is popping it up all over the web without my agreement.
    Do you know any methods to help protect against content from being stolen? I’d certainly appreciate it.

  31. Remarkable things here. I am very satisfied to look your post.
    Thanks a lot and I’m having a look ahead to
    touch you. Will you kindly drop me a e-mail?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>