Home › Forums › JavaScript › Best Way To Link To JQuery File?
- This topic is empty.
-
AuthorPosts
-
April 26, 2011 at 3:48 pm #32498ChrisBullMember
Firstly, why link to someone elses jquesy file when you can have a copy of your own?
Then, I used to link to googles file but then read about google being banned in a few countries so they wont be able to have the jquery file surely?
So that leaves? Microsofts link?OR is it actualy better to link to your own hosted file?
OR is there a best of both? Someway that you can try to link to someone elses and if that doesnt work use your own hosted one?
Any Ideas?
April 26, 2011 at 4:06 pm #49148whiteInkDesignMemberA number of countries block YouTube and some block StreetView, but the only ones that block Google as a whole as far as I know are China and Vietnam. Do you get a lot of pageviews from China and Vietnam? Then just load jq from your js folder, no biggie.
April 26, 2011 at 5:31 pm #49163chrisburtonParticipantI would agree with wolf 110%. If you had the file on your own server, other people would have to redownload it from you while they most likely already had it cached from google. So basically it would be pointless and second, less space taken up although its quite small.
April 28, 2011 at 12:44 am #48899mshort1985MemberI agree it’s best to use a CDN. I had no idea china had banned Google, thats kind of stupid I think. Although I guess it could be because of googles Cacheing of sites, not sure if that would allow chinese people to get around the firewall that the government has up or not.
so yeah, do use a CDN, and if you get large amounts of traffic from china take wolf’s advice and use a local copy as a fallback solution.
June 25, 2012 at 4:17 pm #104851justme243MemberBut how can I do this, with other scripts, too? Like this one:
http://browser-update.org/update.jsIt doesn’t seems to work with the typeof thing, if I write update or browser-update or something like that, instead of jQuery.
Any ideas? Thanks in advance. Again thanks a lot for this post.
June 26, 2012 at 2:41 am #104862JohnMotylJrParticipantPersonally, i say go with someone reliable who is already hosting it, like Google. You have a better chance of hitting a cached browser with that jQuery and if they don’t have it ( or the country had blocked it ) than just load a local version like wolfcry911 said.
Maybe some analytics system on your site to find your target audience with geo-location would help.
April 3, 2013 at 4:40 am #130496Historical Forums UserParticipantI’ve linked my application to Google’s CDN and to my local jquery but it still won’t load the script for some reason :
Anything I’m doing wrong / any suggestions on what I could do better ? Thanks in advance.
April 3, 2013 at 5:01 am #130501CrocoDillonParticipantIf you want jQuery you should try to load jQuery instead of jQuery UI. If you want jQuery UI I didn’t say anything :)
April 3, 2013 at 8:38 am #130512PicnicTutorialsParticipantDont buy into the hype. It’s always better to host things from your host. Regardless if it’s coming from google or microsoft. Unless you prefer to be dependent on other peoples uptime.
That said for demos or development I will use…
script type=”text/javascript” src=”http://code.jquery.com/jquery-latest.min.js”>
April 3, 2013 at 9:13 am #130515PicnicTutorialsParticipantno reason. I just dont buy into it. Regardless if 5 out of 100 people already have it cached I prefer to keep everything inhouse
April 3, 2013 at 1:49 pm #130538PoddersParticipant> But how can I do this, with other scripts, too?
Most, if not all scripts will register some kind of variable/object/function to the window to check against, jQuery registers jQuery and the $ shortcut, jQuery UI registers jQuery.ui and that script you posted as an example registers a variable named $bu, so in your case the cdn vs local check would be
Where you also store a local copy in a folder named "js"
April 3, 2013 at 1:53 pm #130539CrocoDillonParticipantYou’re not dependent if you provide a local copy as fallback like you should.
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.