Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Fontdeck import always returns the URL to the font over the http protocol, and therefore when viewing a site over https:// many browsers show an insecure content alert. The attached patch adds support for protocol-relative URLs for the Fontdeck provider.
An alternative approach would be to replace http:// with https:// in the preprocess_html function, but why do extra work?
Comment | File | Size | Author |
---|---|---|---|
fontyourface-fontdeck-protocol-relative.patch | 553 bytes | mstrelan | |
Comments
Comment #1
mstrelan CreditAttribution: mstrelan commentedComment #2
BarisW CreditAttribution: BarisW commentedA better approach might be to make it protocol independent.
If I check what Fontdeck suggest themselves, they do it without http or https:
<link rel="stylesheet" href="//f.fontdeck.com/s/css/ScoVjeoYB6zuTej+cVkW6updESk/DOMAIN_NAME/29315.css" type="text/css" />
Comment #3
Drave Robber CreditAttribution: Drave Robber commented@BarisW: this is exactly what this patch does - it replaces
http://
orhttps://
with//
. :)btw, where does Fondeck suggest this (link)?
Comment #4
BarisW CreditAttribution: BarisW commentedAh my fault. THen it looks good. However, does it need a hook_update() to re-import all fontdeck fonts?
You can find info here: http://fontdeck.com/support/tutorial (HTML method)
Comment #5
Drave Robber CreditAttribution: Drave Robber commentedThe reason I'm a bit more cautious about this is Edge Fonts similarly recommends protocol-independent URLs "for most cases", but then goes on to tell there might be exceptions. Well, "local file-based development" isn't the case with Drupal.
In edge_fonts.module, protocol-independent is the default setting, but you can switch to "ask the server".
Comment #6
Drave Robber CreditAttribution: Drave Robber commentedPotentially related: #1891820: fontdeck_get_domain() - stripping www is not necessary
I'll try to set up a sandbox to play with both these over the weekend.
Comment #7
Neslee Canil Pinto