The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 23, 2019, 12:27:47 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Host your own js and css or grab them from a CDN?  (Read 2259 times)
dink
Expert
****
Offline Offline

Posts: 349


View Profile
« on: June 15, 2013, 11:43:14 PM »

In my previous life I hacked together all of my own css files and kept them on the server.  This new day of mobile apps has changed the way some folks do their thing.

I'm building an app that is supposed to work on all known mostly modern desktops and mobile devices.  To do this, I need js files from jQuery and jQuery Mobile and css files from the last one.  They good folks who created these nifty programs have kindly provided minified versions of both sets of code.  From what I've read, this means that the spaces, line feeds, and so on, have been trimmed away.  Then they have the files zipped up.  Cool enough.

There are several Contend Delivery Networks that provide similar files over the webs.  Google APIs have a bunch, Microsoft does as well.  jQuery and jQ Mobile host their full set for CDN purposes.  Their respective websites also offer a download of the full sets if one would wish to host them at home.  A small note here:  The other CDN sites do not always host the most recent stable versions.

So, provided that you don't want to get into the guts of the files, which way is best to make the codes available to your application?

Of course, 'best' is relative to your personal pleasure and is completely subjective.  Still, it is worth asking you smart guys what you think.

For the pro side, I think I see that serving your own code would prevent a delay in page loading if the CDN was busy or off line.

On the con side, some server providers charge for calls like these.

One could make sure that the files were cached, but that only works for the second and subsequent times a guest hits the page.  I suppose it wouldn't be too hard to code up something in the beginning of the page that said 'go get the CDN unless they are busy, then get these local ones'.

What do you think?

?Dink
Logged

[quote Nutballs]
the universe has a giant fist, and its got enough whoop ass for everyone.
[/quote]
Bompa
Administrator
Lifer
*****
Offline Offline

Posts: 564


Where does this show?


View Profile
« Reply #1 on: June 16, 2013, 01:09:52 AM »

I don't use any of that fancy stuff because I only write tiny scripts that
serve my own selfish purposes, but, in any case, I like to keep things local.

Also, I very much dislike it when I am loading a page and I see it
accessing 5, 10, or whatever other domains.

but that's just me.
Logged

"The most beautiful and profound emotion we can experience is the sensation of the mystical..." - Albert Einstein
dink
Expert
****
Offline Offline

Posts: 349


View Profile
« Reply #2 on: June 16, 2013, 10:39:54 PM »

I agree with that.  It also gets my dander up when the page can't fully load because the server is waiting for some distant thingy to load.

If someone as smart as you are gets disgusted by the page trying to load a bunch of other domains, that's good enough for me.  I'll host my scripts locally and take the small server hit.

$Dink
Logged

[quote Nutballs]
the universe has a giant fist, and its got enough whoop ass for everyone.
[/quote]
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: June 19, 2013, 07:38:56 AM »

I use Google for jquery and such because it helps with traffic just a little. Speed is a wash because sometimes it's quicker from mine, sometimes its quicker from them. But at the end, if my server is less busy I can handle more surfers.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
dink
Expert
****
Offline Offline

Posts: 349


View Profile
« Reply #4 on: June 19, 2013, 03:17:03 PM »

Speed of download is something that I was wondering about.  I've seen the Giggle servers slow at times.  I suppose it depends on how many hops it takes for the data to be available.  I doubt that one would have to worry about their api never being available.  It's worth noting that Google was not serving up the most recent stable of jq Mobile when I checked them out.

Perk, have you noticed many surfers coming in with a cached copy of the Google js?

Here's another QQ:  I know absolutely nothing about this, so... If your inner pages were carrying an HTTPS header, would the CDN api be reachable from those pages?


?Dink
Logged

[quote Nutballs]
the universe has a giant fist, and its got enough whoop ass for everyone.
[/quote]
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #5 on: June 20, 2013, 09:09:02 AM »

Users would probably get the "There's insecure data being requested for this page" message. It's doable but freaks people out I think ... especially since the unsecured data would be coming from another domain, might make them think there's mischief afoot.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!