jqueryyiijquery-2.0

Why do I get "script error" while using jQuery on IE 8?


'clientScript' => array(
        'packages' => array(
            'jquery' => array(
                'baseUrl' => 'http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/',
                'js' => array('jquery.min.js'),

I'm using Yii Framework and the above code is in my config/main.php

The jQuery loads properly on all major browsers, but not on IE <= 8.

How can it be solved?


Solution

  • Try to add this in footer layout to solve this problem, i have the same and i solve like this:

        <!--[if !IE]>-->
    
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
    
        <!--<![endif]-->
    
        <!--[if IE]>
            <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <![endif]-->
    
    <?php
    
        // move all the scripts to footer and disable the default yii jquery
        Yii::app()->clientScript->coreScriptPosition=CClientScript::POS_END;
        Yii::app()->clientScript->scriptMap=array(
            'jquery.js'=>false,
            'jquery.min.js'=>false,
        );
    
    ?>