When visiting a secure website (https://), you will get a warning if there are any unsecure requests (http://). The Typekit module should use http://typekit.com or https://typekit.com when making the request for the JavaScript depending on whether Drupal is on the secure protocol.

CommentFileSizeAuthor
#5 typekit_https.patch1.06 KBcwgordon7

Comments

robloach’s picture

Status: Active » Needs review
  // Check for key
  if (!empty($key) && $page_match && $enabled) {
    // Construct the Typekit JavaScript URL.
    $url = url('http://use.typekit.com/' . check_plain($key) . '.js', array(
      'external' => TRUE,
      'https' => !empty($_SERVER['https']),
      'absolute' => TRUE,
    ));
    // Include the TypeKit code.
    drupal_add_js($url, 'external');
    drupal_add_js('try{Typekit.load();}catch(e){};', 'inline');
  }
zzolo’s picture

Hi @Rob. Thanks for the code. I don't actually have a site with HTTPS easily available to test this. The code looks good, but is there anyone out there to confirm this?

robloach’s picture

Status: Needs review » Needs work

Michael Cooper pointed out that it should check to use http vs https via JavaScript instead, like how Google Analytics does it....

<!--//--><![CDATA[//><!-- 
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); 
//--><!]]>
soyarma’s picture

We're going to write this up for acquia.com in the next few days and submit it as a patch.

cwgordon7’s picture

StatusFileSize
new1.06 KB

Here's a patch for doing it in JavaScript. To clarify, it's better to do it in JavaScript because Drupal might cache a page over http and serve it over https or vice-versa.

zzolo’s picture

Status: Needs work » Fixed

Didnt really have time test, but committed:
http://drupalcode.org/project/typekit.git/commit/bcf9f2d

soyarma’s picture

This is tested and in place on Acquia.com. As a note, you need the professional subscription with typekit for the css that the typekit js loads to also be served over https.

robloach’s picture

Thanks a lot for patchinating it, Charlie!

Status: Fixed » Closed (fixed)
Issue tags: -https

Automatically closed -- issue fixed for 2 weeks with no activity.