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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4
    • 2.4
    • Libraries
    • MOODLE_24_STABLE
    • MOODLE_24_STABLE
    • w46_MDL-36481_m24_intranetie
    • 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

    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);
              }
          }

      Attachments

        Activity

          People

            skodak Petr Skoda
            quen Sam Marshall
            Dan Poltawski Dan Poltawski
            Michael de Raadt Michael de Raadt
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              3/Dec/12