You are here

function _cdn_prefetch_dns in CDN 6.2

Helper function to add DNS prefetching to the page.

See also

http://drupal.org/node/1247078.

1 call to _cdn_prefetch_dns()
cdn_init in ./cdn.module
Implementation of hook_init().

File

./cdn.module, line 817

Code

function _cdn_prefetch_dns() {
  $domains = cdn_get_domains();
  if (count($domains)) {

    // Enable prefetching.
    drupal_set_html_head('<meta http-equiv="x-dns-prefetch-control" content="on" />');

    // The domain names to prefetch. Use protocol-relative URLs.
    foreach ($domains as $domain) {
      drupal_set_html_head('<link rel="dns-prefetch" href="//' . $domain . '" />');
    }
  }
}