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

          Attachments

            Activity

              People

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

                Dates

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