Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I realise jQuery 2.0 dropped support for some browsers including IE7 and IE8.

I'm only using a bit of jQuery on my WordPress site, but since I need to support IE7/IE8, I was wondering what the best way was to go about including older versions of jQuery? Or should I just choose one version (like 1.9.1), that supports older and more modern browsers, and stick with that?

I'm currently injecting jQuery into my functions.php like so:

if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
    wp_deregister_script('jquery');
    wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js", false, null);
    wp_enqueue_script('jquery');
}

Any help is appreciated. Thanks in advance!

share|improve this question
4  
Use the default jQuery (as you should anyway), and you get the compatibility script for free. –  toscho Feb 2 at 23:27
1  
Thanks for this. After reading your comment I've read a few articles about using WP's default jQuery. Completely baffled as to why this barebones theme I'm using decides to include jQuery in this way. –  realph Feb 3 at 0:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.