"The Great Firewall of China"
According to Wikipedia Google, Facebook, Twitter and YouTube are blocked in China since 2014. This means that not only search engine, maps and Gmail are unavailable, but also CDN, APIs and fonts. If you use any of that in production, then in the best case, your site has a different layout and in the worst - your customers are waiting for 30 seconds before your JS, which is loaded synchronously, finally fails due to timeout only to find your site is broken.
The Great Firewall of China is a term used by media to refer to legislation and projects initiated by the Chinese government (which is controlled by the Communist Party of China, CPC) that attempt to regulate the Internet in Mainland China. It is the main instrument to achieve Internet censorship in China. These CPC regulations include criminalizing certain online speech and activities, blocking from view selected websites, and filtering keywords out of searches initiated from computers located in Mainland China.
I Don't Care About China
It is a huge mistake to think that you don't have customers in China. Nowadays many people from different countries of the world are either living of regular flying here for business. Your clients might still be interested in buying your goods or services remotely and by making your site unavailable to them, you make a huge favor for your competitors. Keep in mind that your customers might not return after the switch.
How to Resolve the Issue
- Don't worry about google-analytics and social buttons. You can keep them as they are loaded asynchronously and therefore don't make any impact on usability or performance. However, there are two side-effects worth to mention. First, they are not rendered on the page. Second, your page loading indicator in the browser will spin for extra 30 seconds before JS finally fails to load.
Does VPN Solve the Issue?
Well, yes and no.
- VPN is illegal in China. Making your customers break the law to use your site might be not the best idea.
- Most users are not techies. They might have hard times to setup and use VPN.
- China is always finding a way to block VPN providers. So what works today, might not work tomorrow.
- Thanks to the "Great Firewall of China," international Internet resources might work very slowly here. If your site works fine without VPN, it will work on average faster for your customers.
How Can I Reproduce the Issue Without Going to China?
- Delete your browser cache to make sure that no cached resources are used
- Temporary add to your hosts file line "127.0.0.1 ajax.googleapis.com" and check different sites, which rely on it. For example, stackoverflow.com. While URLs are still working fine and site is more or less usable, some functionality is broken. It might be a good example but also keep in mind that jquery is loaded synchronously, therefore in the real world, you had to wait for 30 seconds before the site is initially rendered.
- You might also install software, which helps to emulate slow networks. Set the speed to 128 kBit/s, and now you can test, how "fast" are foreign websites in China.
I hope that I was able to convince you to switch from Google CDN to other CDNs or serve your resources locally. It is very easy to make some folks like me happier one day. :)