Correct Way To Load An Alternate Version Of jQuery For IE8 And Below

339 Views Asked by At

I would like to update the jQuery library on my site, but when I use the newer versions (2+?) certain things stop working when using IE 8 or below.

After reading more than several posts about using alternate versions of jQuery depending on certain conditions, I have a couple questions about the actual implementation - refer to the versions below:

VER1

  <![if !IE|gte IE 8]>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <![endif]>

  <![if lt IE 9]> //(COMMENTED OUT)
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  <![endif]>

VER2

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

  <![if lt IE 9]> //(COMMENTED OUT)
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  <![endif]>

First Question: Both versions seem to be work as expected so far. In VER2, will IE8 and below browsers end up loading two versions of jQuery (which as I understand it, can cause issues)?

Second Question: Would VER1 be an acceptable or conventional implementation of what I am trying to achieve?

0

There are 0 best solutions below