Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36481

IE8/9/10 user agent detection on intranet sites may be incorrect

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide

      1/ run unit tests
      2/ test svg icons and body examine the body class matches the selected browser compatibility in IE9+IE10
      3/ add your test site to the list of intranet sites in IE (Internet options / Security / Local intranet / ...)
      4/ repeat step2, the body class should be the same as before

      Show
      1/ run unit tests 2/ test svg icons and body examine the body class matches the selected browser compatibility in IE9+IE10 3/ add your test site to the list of intranet sites in IE (Internet options / Security / Local intranet / ...) 4/ repeat step2, the body class should be the same as before
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w46_MDL-36481_m24_intranetie

      Description

      When using a local (intranet) site, IE8+ will visit it in IE7 compatibility mode. Moodle now uses a meta tag in the theme to force IE to use its latest rendering mode, which solves this problem. However, the user agent remains as the IE7 user agent.

      Parts of Moodle code that detect IE version should be modified so that they correctly detect the 'IE9 pretending to be IE7' user agent. This applies at least to the get_browser_classes function, maybe also the check_browser_version or whatever that is called?

      You can detect these user agents because (a) they look like IE7, (b) they have Trident/something.

      Here is example code used at OU to modify the output of get_browser_classes:

          if ($useragent) {
              // Speculatively support IE11, IE12 even though they don't exist yet.
              if (strpos($useragent, 'Trident/4.0') !== false) {
                  $classes = str_replace('ie7', 'ie8', $classes);
              } else if (strpos($useragent, 'Trident/5.0') !== false) {
                  $classes = str_replace('ie7', 'ie9', $classes);
              } else if (strpos($useragent, 'Trident/6.0') !== false) {
                  $classes = str_replace('ie7', 'ie10', $classes);
              } else if (strpos($useragent, 'Trident/7.0') !== false) {
                  $classes = str_replace('ie7', 'ie11', $classes);
              } else if (strpos($useragent, 'Trident/8.0') !== false) {
                  $classes = str_replace('ie7', 'ie12', $classes);
              }
          }

        Gliffy Diagrams

          Activity

          Hide
          skodak Petr Skoda added a comment -

          Thanks a lot for the report, I have implemented the hacks in a bit different way and fixed svg icons to work on intranet sites too.

          Show
          skodak Petr Skoda added a comment - Thanks a lot for the report, I have implemented the hacks in a bit different way and fixed svg icons to work on intranet sites too.
          Hide
          quen Sam Marshall added a comment -

          That was quick! By the way, I had a quick look at it and I like the way you did the changes, +1 from me.

          Show
          quen Sam Marshall added a comment - That was quick! By the way, I had a quick look at it and I like the way you did the changes, +1 from me.
          Hide
          skodak Petr Skoda added a comment -

          hehe, I spent most of the time testing that thing, thanks for the quick review!

          Show
          skodak Petr Skoda added a comment - hehe, I spent most of the time testing that thing, thanks for the quick review!
          Hide
          poltawski Dan Poltawski added a comment -

          Integrated, thanks.

          (bah IE team, why must you make our job so hard! Please add a 'yes I really want you to be standards compliant and reporting properly option')

          Show
          poltawski Dan Poltawski added a comment - Integrated, thanks. (bah IE team, why must you make our job so hard! Please add a 'yes I really want you to be standards compliant and reporting properly option')
          Hide
          salvetore Michael de Raadt added a comment -

          Test result: Success

          Show
          salvetore Michael de Raadt added a comment - Test result: Success
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Many, many thanks for your effort!

          Millions of people will enjoy the results of your work, yay!

          Closing as fixed. Ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Many, many thanks for your effort! Millions of people will enjoy the results of your work, yay! Closing as fixed. Ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Dec/12