-1

i'm confused whether to include jquery.js or bootstrap.js files from my domain or to link the files directly to the download page of the providers. what is the most common practise? i want to load my sites quickly, thus i have 2 options:

  • hoping my users already have the originaldomain.com/jquery.js cached (but if not loading from the original site may be longer than from my own megaspeed domain)
  • include them at mydomain.com/jquery.js and every user must donwload it
ulkas
  • 5,748
  • 5
  • 33
  • 47
  • I doubt that your host is faster than Google's CDN. – SLaks Feb 27 '13 at 19:33
  • Possible duplicate: http://stackoverflow.com/questions/547384/where-do-you-include-the-jquery-library-from-google-jsapi-cdn – danii Feb 27 '13 at 19:33
  • 1
    @SLaks: from other point - now you're relying on availability of 2 services: your own and Google's. 2 is twice worse than 1. And google's CDN may fail not because of its own failure, but because of, say, DNS failure. My ISP once experienced issues so that google's domain names wasn't resolved properly. – zerkms Feb 27 '13 at 19:35
  • @zerkms it's not about availability, i want to set it up the way user will download as less files as possible when he first visits my page - the first impression of whether the site is fast or not. thus i would risk the external unavailable source in case the user actually does not download since he might have it in browser cache since the external source is included almost in every page. so the browser of my user will take most of the page from general cache and just some html output from my server – ulkas Feb 27 '13 at 19:57

1 Answers1

1

It depends on your purpose - Google's CDN is likely faster than what you have, but hosting it yourself makes sense if you intend on minifying all of your script files into one large minified script file.

BahamutWC
  • 194
  • 2
  • 8
  • what i would like to know is, how does the browser cache work for these files - i assume when linking to google the user actually does not even download the file since he has most-likely downloaded it far before he visited my site at some other site which used the same link to js file. – ulkas Feb 27 '13 at 19:44