An option to transform any http:// src attributes, into https:// depending if the page is being viewed is in https or not. This ensures that nasty warnings don't plague the user in IE.

In my version of this module, I did it like so:

function javascript_bypath_init() {
  global $_javascript_by_path_script;

  if ($rule = _javascript_bypath_path_rule_load()) {
    $_javascript_by_path_script = _javascript_bypath_scripts_load($rule->id);

    if (_javascript_bypath_is_secure()) {
      $value = str_replace('http://', 'https://', $_javascript_by_path_script->script_value);
    }
    else {
      $value = str_replace('https://', 'http://', $_javascript_by_path_script->script_value);
    }
    drupal_add_js(drupal_validate_utf8($_javascript_by_path_script->script_value) ? $_javascript_by_path_script->script_value : '', 'inline', 'footer', FALSE, FALSE, FALSE);
  }
}

function javascript_bypath_footer() {
  global $_javascript_by_path_script;

  if ($_javascript_by_path_script) {
    if (_javascript_bypath_is_secure()) {
      $value = str_replace('http://', 'https://', $_javascript_by_path_script->noscript_value);
    }
    else {
      $value = str_replace('https://', 'http://', $_javascript_by_path_script->noscript_value);
    }

    $value = drupal_validate_utf8($value) ? $value : '';
    return '<noscript>'. $value .'</noscript>';
  }
}

Obviously you would want a config option to turn this feature on/off per rule though.

Comments

astonvictor’s picture

Status: Active » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks