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

URL resources embedded from the same website fail or are slow to load in IE

    XMLWordPrintable

Details

    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • w42_MDL-29444_m22_iframe
    • Hide

      Applying the attached patch to lib/resourcelib.php fixes the problem by removing the check for internal URLs thereby causing iframes to be used for all HTML pages embedded within Moodle when viewed with IE.

      Show
      Applying the attached patch to lib/resourcelib.php fixes the problem by removing the check for internal URLs thereby causing iframes to be used for all HTML pages embedded within Moodle when viewed with IE.
    • Hide

      Using IE:
      1/ create resource that links to any html page
      2/ make sure the page is displayed in iframe

      Show
      Using IE: 1/ create resource that links to any html page 2/ make sure the page is displayed in iframe

    Description

      When using a URL resource with the Display type set to 'embed' to show a URL from elsewhere within Moodle, the embedded pages frequently fail to display. In IE 9 the page usually displays after a long delay (typically a minute), in IE 8 a blank frame is always displayed.

      This is being caused by the following code in 'function resourcelib_embed_general' of lib/resourcelib.php

      $iframe = false;
      // IE can not embed stuff properly if stored on different server
      // that is why we use iframe instead, unfortunately this tag does not validate
      // in xhtml strict mode
      if ($mimetype === 'text/html' and check_browser_version('MSIE', 5)) {
          if (preg_match('(^https?://[^/]*)', $fullurl, $matches)) {
              if (strpos($CFG->wwwroot, $matches[0]) !== 0) {
                  $iframe = true;
              }
          }
      }

      This code causes URLs which match the $CFG->wwwroot to be treated differently to other URL's on the grounds that only the URL's on another server actually cause a problem. However, my tests have shown the embedding fails for local pages as well on IE.

      Replication steps:

      1. Create a URL resource pointing at the front page of the Moodle installation with the display type set to embed.
      2. The page should be quickly displayed in a box on the page. In IE, the page is either slow to load (IE9) or fails to load (IE8).

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              tim1mw Tim Williams
              Sam Hemelryk Sam Hemelryk
              Jason Fowler Jason Fowler
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona), Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                28/Nov/11