0

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!

2
  • 4
    Use the default jQuery (as you should anyway), and you get the compatibility script for free.
    – fuxia
    Feb 2, 2014 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, 2014 at 0:12

1 Answer 1

1

Currently (WP 4.6) WordPress includes jquery 1.12.4, so as @toscho notes there are no compatibility issues with older IE browsers.

However, it was recently announced that 1.12.4 will be the last jquery version of that branch. Sooner or later WP will have to move to jquery 3.0 branch, in which all support for IE 6-8 will have been dropped.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.