Waiting reply from ajax.googleapis.com
I have added jQuery to my webiste from google. The awful part is the completly slowness of google server. Sometime my website stops while trying to loading jquery from googleapis:
<script src="http://ajax.开发者_运维百科googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
Can i do something? It's better to load jquery from other servers ? (maybe mine?) When the "waiting reply from ajax.google" appears i can stay 30min waiting and nothing happens, I have to reload the page to show it
In my case, I found its better to NOT use external CDN.
- You don't have power over it, Google can stop serving a version of jQuery
- On page load, it means 1 HTTP request to 1 different host (not good since browser does parallel queries)
- Most of the time you use a minifier so you can include the jQuery lib in your big minified file to reduce HTTP requests
And I found that Google CDN is very slow... I constantly get "Waiting for ajax.google....."
I've never had a problem with it.
On a side note, you should always use the full version of jquery. e.g. -
http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js
You lose the caching benefits if you use simply 1.4 or 1.5.
Here's a pretty good article about why you should use the Google CDN:
http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/
It is better to use google CDN then loading from your server. Most of the users already have jQuery from google cached and don't even have to load it. Read the 3 reasons why you should use google to load your jQuery http://encosia.com/2008/12/10/3-reasons-why-you-should-let-google-host-jquery-for-you/
You can also try loading jQuery from microsoft CDN at
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.min.js
You can also have jQuery load from your server in case it wasn't loaded from google. You do that by writing
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined')
{
document.write(unescape("%3Cscript src='/jquery-1.5.1.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
FWIW I was having atrocious load times from chrome (2m+) with a codebase then I discovered it was using:
https://ajax.googleapis.com/... # slow
Switching away from https
in the code fixed it, now it's lightning fast (as long as you're online):
http://ajax.googleapis.com/... # fast
Sorry OP, I see you're not using https
but perhaps this will help others. But wrt the original thread I prefer to have control and be able to do offline development, and if you put static assets on a good CDN it's a much of a muchness whether you use Google's or your own. But if you want something fast for others without hiring a CDN it's a tradeoff, as others have said, between relying on Google's CDNs (which could go away at some point, though not likely soon) or setting up your own or giving your users a slower load time.
I know it has been a while and this is an old issue.
Similar things happened to me and I can assure you it s not because of google's cdn. In my case it only happens for in the Google Chrome not Firefox or Internet Explorer (not event IE can you believe it) so I decided to remove html parts one by one and turns out it s space entities in the html like tons of
some how Chrome cannot handle them correctly (tries to replace them all I think) and this cause the problem and always show waiting message.
Basically the content guy used these entities to for correcting layout of some data. I used a simple table instead and fixed my problem.
This one about one year ago and I also sent a bug report to Google using Chrome. well I am not sure it has been fixed or not.
Hope this helps someone.
精彩评论