Search code examples
javascriptvbscriptinternet-explorer-10moodlescorm

Convert VBScript to Javascript


Busy debugging a strange issue relating to the way some Flash content communicates a user's progress from a SCORM module back to Moodle.

On IE 6, 7, 8, 9, Chrome and Firefox, everything works fine. On IE 10, progress tracking from the Flash module is not reaching the server.

In the SCORM launcher, an event handler is created using the following (ancient) code:

<SCRIPT LANGUAGE="VBScript">
on error resume next
sub preloader_FSCommand(ByVal command, ByVal args)
  call preloader_DoFSCommand(command, args)
end sub
</SCRIPT>

Debugging on Chrome, I can see that the function is called as expected.

Attempting to debug in IE 10 fails, as the code is never called. How would I translate this code to Javascript? Trying to remove the VBScript as it appears to be part of the problem. I tried the following code, without success:

<script>
      function preloader_FSCommand (command, args) {
           preloader_DoFSCommand(command, args);
      }
</script>

preloader_DoFSCommand is defined elsewhere in code, and is called just fine on Chrome/Firefox/etc, but not on IE 10.

Update: Seems that part of the problem is related to IE 10 no longer supporting FSCommand in standards mode. Question now becomes, what would be a suitable workaround, which does not require the Flash/SCORM content to change?


Solution

  • Try to force IE10 into IE9 compatibility mode with the following in your <head>: <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />