[Drupal] duplicated entry for meta httpequiv="ContentType" in the headarea

look in the source of the d.o theme:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

one <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> is definitly enough.

That is the problem of D6, you will find this details in

here is an example to resolve it.

In you theme, here is demo theme, template.php file,

function demo_preprocess_page(&$vars, $hook) {
  
//other codes. 
  //Put the code below at the end of this function.


  
$head_old = explode("\n", $vars['head']);
  
$head_new = '';
  
foreach ($head_old as $k=>$v) {
    
if (strpos($v, 'charset=utf-8'=== FALSE) {
      
$head_new .= $v . "\n";
    }
  }
  
$vars['head'= $head_new;


After that, you will resolve this problem.

Have fun with Drupal! 

原文地址:https://www.cnblogs.com/davidhhuan/p/2000806.html