问题
I worked on a Project recently; and upon starting one of the first things mentioned was to NOT use google CDN nor google web fonts -- there wasn't an explanation.
I have always used CDNs and Google Web Fonts as opposed to font-face; is there any concerns with these google developer options? What could be troublesome?
Is it better practice to use raw sources (EG. Directly from jQuery website) or font-face?
回答1:
This question is very wide, And I can only give my 2 - cents regarding one specific problem. As long as you are in the US - there is usually no problem ( speed, or otherwise ) but in other countries - that is a different story.
Regarding CDN - In some countries, those CDN´s will not work well ( if at all )
One such example is Chine - where I often travel to on Business. And in China, as you know they have the " Great Chinese firewall".
Well - due to recent very published quarrels between Google and the Chinese government, Google services are often blocked, partially or totally. Google has even closed it´s CN domain and moved it to HK .
What does that mean ? it means that websites that rely on google web fonts, or CDN ( for jQuery for example ) might not work in China, or will have sporadic unpredictable effects. As a first result - their loading time will be 10´s of times slower ( if at all ) and usually will end with a time-out on some parts .
The same effect is happening ( and not many people pay attention to that ) with any embedded twitter, or facebook codes. The pages just won´t load.
Now, you can say you do not care about China, and that this is not your target audience - but IMHO disregarding a third of the world´s population is a bit strange.
More over - This has happened to me in OTHER COUNTRIES AS WELL ( granted - most are totalitarian regimes, but still ...)
Regarding google - fonts - you did not really elaborate on the project, but one of the reasons I do not use them frequently is that most of them support ONLY English characters (Note: not LATIN, ENGLISH). So unless you specifically search for them in the font - a lot of European characters will not render ( like ß, á ,À ,í ,ü,ä,é
just to name a few but the actual list is much longer ) - not to mention other languages ( Arab, Hebrew , all Cyrillic based languages like Russian, Bulgarian , Ukrainian - All Asian languages like Chinese, Japanese , Korean and basically any language that is not ENGLISH . Even Spanish is on the list with ¿
and ñ
... so here goes all the Latin in the US... )
So - if your "project" is something that is UI based, and it is meant to be used with Other languages in the future - this requirement is not weird at all...
Summing up - you should use google CDN and font only if you provide a valid fall-back
.
Read : Best way to use Google's hosted jQuery, but fall back to my hosted library on Google fail
Like said at the beginning - this is just my 2-cents on the matter. I am sure other people can give you a different point of view.
来源:https://stackoverflow.com/questions/19943588/is-google-web-fonts-or-cdn-bad