3 ms·
Why would someone need JS to load a font? You can use them just fine with a link in the header and CSS.
by favicons 9y ago
Why would someone need JS to load a font? You can use them just fine with a link in the header and CSS.
- taspeotis 9y agohttps://developers.google.com/fonts/docs/webfont_loader https://developers.google.com/fonts/docs/webfont_loader
- vog 9y agoYes, that explains why they use it. But it does not explain why they need to use it.
- vog 9y agoI don't get it, either. Indeed, they do include their fonts with plain <link> elements: <link href='//fonts.googleapis.com/css?family=PT+Sans|Signika:400,600' rel='stylesheet' type='text/css'> <link href='//fonts.googleapis.com/css?family=Signika:300,700' rel='stylesheet' type='text/css'> But effectively, those fonts are only used when JS is enabled. Moreover, they load a bunch of other JS libraries whose added value is practically non-existent (except maybe for their "email protection"): <script type="text/rocketscript" data-rocketsrc="https://www.stopbadware.org/misc/jquery.once.js?v=1.2"></script> <script type="text/rocketscript" data-rocketsrc="https://www.stopbadware.org/misc/drupal.js?ooq842"></script> <script type="text/rocketscript" data-rocketsrc="https://www.stopbadware.org/sites/all/modules/jquery_update/replace/ui/external/jquery.cookie.js?v=67fb34f6a866c40d0570"></script> ... <script type="text/rocketscript" data-rocketsrc="https://www.stopbadware.org/sites/all/libraries/superfish/sftouchscreen.js?ooq842"></script> ... (Note the that "superfish" here is about menus, i.e. not the well-known badware distributed by Lenovo.)
- lucb1e 9y ago> <link href='//fonts.googleapis.com/... Your code example reminds me of what I just read on the StopBadware website: > Some badware may not have malicious intentions, but still fails to put the user in control. Consider, for example, a browser toolbar that helps you shop online more effectively but does not mention that it will send a list of everything you buy online to the company that provides the toolbar. Using hosted fonts so that they may be cached and CDN-served might not be bad, but the use of these has the effect of sharing everything you do online with Google.
- NoGravitas 9y agoIt's also quite trivial to serve them locally (even fonts that you got from Google Fonts), and http/2 greatly reduces the impact of serving them (as long as they are reasonably sized). And font-display: fallback or font-display: optional in your css will also reduce the impact.