Moodle
  1. Moodle
  2. MDL-29444

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

    Details

    • Testing Instructions:
      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
    • Workaround:
      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.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w42_MDL-29444_m22_iframe
    • Rank:
      18949

      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).

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this and providing a potential solution.

          Show
          Michael de Raadt added a comment - Thanks for reporting this and providing a potential solution.
          Hide
          Petr Škoda added a comment -

          To integrators: please cherry pick to stable branches.

          Thanks a lot for the report!

          Show
          Petr Škoda added a comment - To integrators: please cherry pick to stable branches. Thanks a lot for the report!
          Hide
          Sam Hemelryk added a comment -

          Thanks Petr - this has been integrated now

          Show
          Sam Hemelryk added a comment - Thanks Petr - this has been integrated now
          Hide
          Sam Hemelryk added a comment -

          Hoorah for HTML 5 btw!

          Show
          Sam Hemelryk added a comment - Hoorah for HTML 5 btw!
          Hide
          Jason Fowler added a comment -

          All good

          Show
          Jason Fowler added a comment - All good
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Done, your delicious hacks have been sent upstream, many thanks!

          Closing as fixed, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Done, your delicious hacks have been sent upstream, many thanks! Closing as fixed, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: