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?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mstrelan’s picture

Status: Active » Needs review
BarisW’s picture

Status: Needs review » Needs work

A 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" />

Drave Robber’s picture

Status: Needs work » Needs review

@BarisW: this is exactly what this patch does - it replaces http:// or https:// with //. :)

btw, where does Fondeck suggest this (link)?

BarisW’s picture

Ah 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)

Drave Robber’s picture

The 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".

Drave Robber’s picture

Potentially 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.

Neslee Canil Pinto’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)