diff --git a/framework/web/CClientScript.php b/framework/web/CClientScript.php index 2dbb34ed4..4ec9c2741 100644 --- a/framework/web/CClientScript.php +++ b/framework/web/CClientScript.php @@ -99,7 +99,9 @@ class CClientScript extends CComponent if($html!=='') { - $output=preg_replace('/(.*?)(<\\/head\s*>)/is','$1'.$html.'$2',$output,1,$count); + $output=preg_replace('/(.*?)()/is','$1'.$html.'$2',$output,1,$count); + if(!$count) + $output=preg_replace('/(.*?)(<\\/head\s*>)/is','$1'.$html.'$2',$output,1,$count); if(!$count) $output=$html.$output; }