Moodle
  1. Moodle
  2. MDL-34755

SCORM won't open in new window for IE7 and IE8 in compatibility mode

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3.3
    • Component/s: SCORM
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a SCORM activity
      2. Set display package to "New Window"
      3. View the activity in IE8 (compatibility mode off)
      4. Click "Enter" - activity will open in a new window (as expected)
      5. Turn on IE8 compatibility mode
      6. Click "Enter" - activity will open in the current window (not expected)
        Please re-test in Other browsers too - esp FF/Chrome
        (NOTE TO TESTER: pop-ups in 2.3 are dumb... MDL-33755 has a planned improvement)
      Show
      Create a SCORM activity Set display package to "New Window" View the activity in IE8 (compatibility mode off) Click "Enter" - activity will open in a new window (as expected) Turn on IE8 compatibility mode Click "Enter" - activity will open in the current window (not expected) Please re-test in Other browsers too - esp FF/Chrome (NOTE TO TESTER: pop-ups in 2.3 are dumb... MDL-33755 has a planned improvement)
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      master_MDL-34755
    • Rank:
      43228

      Description

      Due to some odd behaviour in old versions of IE, the JS that binds the onsubmit code fails in IE7 and IE8 in compatibility mode.

      To reproduce:

      1. Create a SCORM activity
      2. Set display package to "New Window"
      3. View the activity in IE8 (compatibility mode off)
      4. Click "Enter" - activity will open in a new window (as expected)
      5. Turn on IE8 compatibility mode
      6. Click "Enter" - activity will open in the current window (not expected)

      For more details see:

      http://stackoverflow.com/questions/95731/why-does-an-onclick-property-set-with-setattribute-fail-to-work-in-ie/
      http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx

      The problem line is in mod/scorm/view.js L18.

      Initially I tried using the YUI Events library to bind the onsubmit event, thinking that it would abstract away any differences but that didn't seem to work for me.

      What did work was to change from using YUI:

      var scormform = Y.one('#scormviewform');

      to plain javascript:

      var scormform = document.getElementById('scormviewform');

      and then replacing the setAttribute call:

      scormform.setAttribute('onsubmit', "window.open('','Popup','"poptions"'); this.target='Popup';");

      with:

      scormform.onsubmit = function()

      {window.open('', 'Popup', poptions); this.target='Popup';}

      ;

      that fixed it for me in IE while it still works in Firefox, Chrome and IE8 with compatibility off.

        Issue Links

          Activity

          Hide
          Dan Marsden added a comment -

          Thanks Simon - have you tested this with Piers direct launch patch too? (MDL-33755)

          Show
          Dan Marsden added a comment - Thanks Simon - have you tested this with Piers direct launch patch too? ( MDL-33755 )
          Hide
          Simon Coggins added a comment -

          No I haven't, but looking at the diff of that patch it uses setAttribute in the same way so I would expect it would have the same problem.

          Simon

          Show
          Simon Coggins added a comment - No I haven't, but looking at the diff of that patch it uses setAttribute in the same way so I would expect it would have the same problem. Simon
          Hide
          Dan Marsden added a comment -

          no worries (I was meaning does the other part of Piers patch still work in IE 8 with standards mode)

          Show
          Dan Marsden added a comment - no worries (I was meaning does the other part of Piers patch still work in IE 8 with standards mode)
          Hide
          Simon Coggins added a comment -

          Ah I see - no I don't think the directview part will be affected, because the bug occurs when binding the javascript to the "Enter" button, and the directview code calls the JS directly.

          Show
          Simon Coggins added a comment - Ah I see - no I don't think the directview part will be affected, because the bug occurs when binding the javascript to the "Enter" button, and the directview code calls the JS directly.
          Hide
          Dan Marsden added a comment -

          heh - if only JS actually worked as expected in all browsers... no worries, I'll add a request for this to be tested across multiple browser types...

          Show
          Dan Marsden added a comment - heh - if only JS actually worked as expected in all browsers... no worries, I'll add a request for this to be tested across multiple browser types...
          Hide
          Dan Marsden added a comment -

          this only affects 2.3 and higher (not 2.2)

          Show
          Dan Marsden added a comment - this only affects 2.3 and higher (not 2.2)
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Sam Hemelryk added a comment -

          Thanks Dan, this has been integrated now.
          Can't say I'm the biggest fan of the move away from YUI there but if it works it works

          Show
          Sam Hemelryk added a comment - Thanks Dan, this has been integrated now. Can't say I'm the biggest fan of the move away from YUI there but if it works it works
          Hide
          Michael de Raadt added a comment -

          Test result: Success!

          Tested in 2.3 and master in IE8 (with and without compatibility mode), FF and Chrome.

          Behaviour was consistent across browsers.

          Agreed: pop-ups are dumb.

          Show
          Michael de Raadt added a comment - Test result: Success! Tested in 2.3 and master in IE8 (with and without compatibility mode), FF and Chrome. Behaviour was consistent across browsers. Agreed: pop-ups are dumb.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Gutta cavat lapidem, non vi sed saepe cadendo - Ovidio

          This issue has been integrated upstream and is now available both via git and cvs (and in some hours, via mirrors and downloads).

          Thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Gutta cavat lapidem, non vi sed saepe cadendo - Ovidio This issue has been integrated upstream and is now available both via git and cvs (and in some hours, via mirrors and downloads). Thanks!
          Hide
          Marion de Groot added a comment -

          But I do still have this problem in 2.4.2:

          Unable to set value of the property 'onsubmit': object is null or undefined
          view.js, line 1 character 1017

          scormform.onsubmit=function()

          {window.open('','Popup',poptions);this.target='Popup';parent.window.location=course_url}

          }

          Show
          Marion de Groot added a comment - But I do still have this problem in 2.4.2: Unable to set value of the property 'onsubmit': object is null or undefined view.js, line 1 character 1017 scormform.onsubmit=function() {window.open('','Popup',poptions);this.target='Popup';parent.window.location=course_url} }
          Hide
          Dan Marsden added a comment -

          Hi Marion,

          please create a new bug and give a lot more information than you have given there..

          please include - full moodle version (btw 2.4.2 contains a major regression with the server files repo and 2.4.3 was released the week after so you should upgrade to 2.4.3 asap)

          Screenshots.

          Exact Browsers and versions that you are having the issue with.

          All SCORM settings you are using - are you using SCORM course format/just adding SCORM to a normal course format etc etc?

          if you are using the SCORM course format - I'd suggest shifting to use the new singleactivity course format that Marina has recently developed - we're hoping to replace the SCORM course format in Moodle core with this new plugin.
          more info here:
          https://moodle.org/plugins/view.php?plugin=format_singleactivity

          Show
          Dan Marsden added a comment - Hi Marion, please create a new bug and give a lot more information than you have given there.. please include - full moodle version (btw 2.4.2 contains a major regression with the server files repo and 2.4.3 was released the week after so you should upgrade to 2.4.3 asap) Screenshots. Exact Browsers and versions that you are having the issue with. All SCORM settings you are using - are you using SCORM course format/just adding SCORM to a normal course format etc etc? if you are using the SCORM course format - I'd suggest shifting to use the new singleactivity course format that Marina has recently developed - we're hoping to replace the SCORM course format in Moodle core with this new plugin. more info here: https://moodle.org/plugins/view.php?plugin=format_singleactivity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: