Are you tiered of seeing the message waiting for “ajax.googleapis.com” at the lower bottom of your browser window and endlessly waiting for the page to load? Well, it is simple to understand that the page you are opening is trying to call something from Google servers and get struck up till the time it receives response. Here is the explanation what the page is calling from Google and possible solutions to overcome the issue.
What is ajax.googleapis.com?
Google maintain these files with the latest version and sets cache header for these libraries. This eliminates the need of placing the script libraries on individual web servers and a mere link to Google server will solve the purpose.
When a page you are trying to open has a link to call Google servers for getting the script libraries then you will see the message waiting for “ajax.googleapis.com”. Right click and view the source of the page once it is loaded, you will be seeing something like below:
<script src="//ajax.googleapis.com/ajax/libs/………."> </script>
Why Google Library Files are Used?
As mentioned above, Google host these libraries and maintain with the latest version. Assume, you are developing a WordPress plugin using JQuery libraries. Providing JQuery library files along with the plugin makes the life more difficult both for you as a developer as well as for the user. Some of the possible problems that could evolve are:
- Theme used by individual people may have different version of JQuery
- Another plugin installed may conflict with the version you have provided with your plugin
- Whenever there is an update, you need to update the plugin with the complete libraries.
- Your plugin size will be large with lot of additional library files.
To overcome all these issues, you can simply include a script line calling JQuery version library from Google servers. Since these files are up to date and most commonly used by theme and plugin developers, the possibility of version conflicts is also highly reduced.
What are the Google Libraries Offered?
Google offers the following libraries hosted on their own servers and hence including any of these scripts will call “ajax.googleapis.com” site for downloading the libraries.
Why Does It Take So Long for Loading?
Now that you must have got an idea of why the message “ajx.googleapis.com” is appearing. Let us come to the problem of why it takes so long and struck up with “waiting for ajx.googleapis.com”? When the page having a link to Google libraries is loaded, the browser will call Google servers to download all the required libraries. The problem here is the behavior of the browsers, which will render the content only after all the required script files are loaded.
This essentially means even if the external Google script libraries are not required to be executed when loading the page, browsers will display the content only after downloading the libraries. You will see “waiting for ajax.googleapis.com” message till the time the files are downloaded to your local browser. Almost all web browsers like Chrome, Firefox, Safari, Edge and IE behaves in the same manner, hence the delay can’t be avoided with the browser change.
Since Google uses caching at various levels to speed up the downloading process, it should be equivalently faster to retrieve the files from your own server. But again the caching can be affected due to many reasons resulting longer downloading time or timeout.
- Your ISP does not have proper DNS lookup setup to retrieve the data faster.
- Google services are blocked by your ISP or in your country.
Possible Solutions to Fix ajax.googleapis.com Issue
Following are some possible ways to fix the Google scripts stop the page loading:
- Use of public DNS
- Blocking with hosts file
- Using script blockers
- Use VPN or proxy service
- Flush DNS
- Clear browser cache
- Contact your ISP
- For site owner
1. Using Public DNS
Correct DNS setup allows the browser to get the required library files quickly from the server. By default browsers obtain DNS servers dynamically from your Internet Service Provider (ISP) which may not be efficient in getting the script files. Alternatively you can use Google public DNS which will have the cached library files and send them quickly to your browser. This will also improve the overall loading speed of the page.
2. Blocking Scripts with Hosts File
If the problem is not resolved with DNS settings change then you can block the API call to Google server by pointing it to localhost in hosts file of your PC or Mac. Browser uses hosts file to map the IP address of any site before going to DNS. Hence blocking it in the hosts file will terminate the API call and load the page without the required resources. Create the below entries in hosts file for IPv4 and IPv6 respectively:
However this is not recommended since blocking the required resource may result in unintended behavior of the page being displayed. Learn how to edit hosts file in Mac and Windows.
3. Using Script Blocker
Install any browser plugins or extensions to block scripts running on the page. Again this will also stop loading the features on the page that using scripts.
4. Blocked Google Services
There are many countries block Google services. If you are living in such a country then use reliable VPN or proxy to access the page calling ajax.googleapis.com. There are premium VPN services like VpyrVPN and ExpressVPN offers anonymous browsing with private DNS. It is also possible that only your ISP blocks Google services or have issues in resolving Google server IPs causing delay in page loading. You can find out this by testing the page on a different network offered by other ISP (for example, open the page on a mobile network).
5. Flush DNS
Your computer also caches the DNS records and uses to speedup the domain resolution process. The outdated DNS records may affect the scripts loading on a page. So flush the DNS on your computer and see whether you can open the webpages without ajax.googleapis.com message.
6. Clear Browser Cache
Over the period of time, the browser may starts accumulating lot of unnecessary cookies and temporary files. These files may cause issue in loading the pages, especially when there are change in the IP / DNS / nameservers of the sites you are opening. The easiest way to overcome corrupted cookies and history files is to delete the browsing history. Generally you can delete the history and cookies by going to the settings page of your browser.
7. Contact Your ISP
If you are not able to resolve the ajax.googleapis.com loading issue with any of the above solutions then the last option is to contact your ISP. Sometimes there could be a configuration problem at ISP side which may also cause issues in loading scripts from Google servers. So your ISP can check both at their end and at your end and help you to resolve the problem.
8. For Site Owners
If you are the site owner, try to avoid using theme or plugins calling Google script libraries. There are many elements on a page like search box, sliders, related post widgets, etc. will call ajax.googleapis.com for the required script files and cause delay. Though it is a difficult task to control the use of each element, using appropriate caching mechanism to serve the files will ensure faster loading of the resources on the page.
Google made an ecosystem to be part of everything on the internet. Unfortunately this is not a good situation that the real users may get affected due to various reasons mentioned above. We believe one of the explained solutions should help you to fix the issue, especially changing to Google DNS or using premium VPN services will definitely help to resolve this ajax.googleapis.com issue.
It’s a breath of fresh air to find a ‘peoples’ site that hasn’t been assimilated by Google. Assuring website visitors privacy is a difficult task when a huge portion of “themes” are dependent upon the GoogleNet (Internet died years ago). Unfortunately, I do see my browser blocking 8 stalkers – at least, you’re letting me see the site without my having to agree to accepting the stalkers.
As web masters, web developers, system ops, web designers, – whatever we are called this week, we have a obligation to ensure our visitors privacy. This is very difficult if one is to keep up with the latest bells, whistles, and bling. Almost all themes and templates are now embedded with a wide variety of stalkers; AKA cookies, beacons, LSOs, Canvas Fingerprinting, RPVs etcetera. Clearly, too many sites see no value on our privacy and put up a site just to track, record, analyze and sell us – our privacy – to anyone with money.
webnots.com doesn’t have all the answers, but it does provide the What, Why and How-tos, in a simple and easy to understand way, not riddled with techineze and kewl kiddie-kode blathering.
Thank you webnots.com for being here,
p.s. Lose the stalkers
Most of the corporate companies spend years in building an ecosystem, like how Google changed the internet started as a search provider. Later changing the ecosystem is almost impossible as many of us don’t even know what happens when using the free services.
“using the free services” (being Google services.)
I must disagree – Google and minions alike, services are not “free”. We pay with our privacy. Google dictates the value of our privacy by marrying ‘privacy’ with ‘free’.
Google uses ads to make money and target us with ads based on our lack of privacy and what Google knows about us. The advertises, get their money from us every time we buy a product, we pay for packaging, ink, shipping, shelving, disposing of, recycling, and a very small amount for the product. But it’s us that pay Google with privacy as well as indirectly, the cost to tell us what we need to buy.
Who gave advertises carte blanche and the Internet? We did as we were being assimilated into the Google collective. We buy expensive devices so we can email, text and trudge through the Google catalog – occasionally landing on the Internet.
Google is an omnipresent tracker, and it’s got to stop. Webmasters need to cut the tentacles to any Google server calls and use alternatives to begin a new privacy based internet dynamic. But that starts with a win-win, reducing the Google payload and speeding up sites too.
Thanks for the nice work here.
It’s difficult to do rather than saying. At least 50% of the developers use free Google fonts / Ajax libraries and other stuffs on their work like themes and plugins. These corporate companies first create an ecosystem to get benefit from the personal data of users. People uses everything on the name of free and later it is not easy to get out of that black box.
Google has it’s tentacles everywhere, unfortunately.
I disallow scripts with temporary allowances for specific loading problems with relatively little site access issues.
Tried all of these, with no improvement. Chrome comes to a complete halt on some sites, Edge never does. But Edge won’t accommodate Dashlane, which I use extensively.
Undoubtedly Chrome is better than Edge and if the problem is due to Ajax scripts then it works similar in all browsers. Probably you can try with Chrome cleanup tool (https://www.google.com/chrome/cleanup-tool/index.html) to check your browser.
Thanks a lot, using a public dns has made a huge difference. Previously could only load a tiny selection of sites as all others would time out during loading. Now they load quicker than ever.