Created
April 19, 2016 04:04
-
-
Save J2TEAM/451a514f232f68104bd4c725a1aef408 to your computer and use it in GitHub Desktop.
Include jQuery based-on user's IE version.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* jQuery 2.x has the same API as jQuery 1.x, but does not support Internet Explorer 6, 7, or 8. | |
* All the notes in the jQuery 1.9 Upgrade Guide apply here as well. Since IE 8 is still relatively common, | |
* we recommend using the 1.x version unless you are certain no IE 6/7/8 users are visiting the site. | |
*/ | |
function include_jquery() { | |
if(preg_match('/(?i)msie [6-8]/', $_SERVER['HTTP_USER_AGENT'])) { | |
// if IE<=8 | |
$version = '1.12.2'; | |
} else { | |
// if IE>8 | |
$version = '2.2.2'; | |
} | |
echo '<script src="//ajax.googleapis.com/ajax/libs/jquery/' . $version . '/jquery.min.js"></script>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment