Forum Discussion

AyseSahin-3327f's avatar
AyseSahin-3327f
Community Member
3 years ago

Javascript not working on the LMS

Hello, I have integrated Javascript into my storyline (and one line into "story.html). It works when I open it locally (once it's been scormed and I click on story.html).

However, IT DOES NOT WORK ON THE LMS, I screenshot the console window in IE browser (it does not work on any browser).

Is someone there having the same issue ? How did you fix it ?

  • RebeccaPartr679  your javascript doesn't use jquery so you don't have the same issue as the other user was challenged with (no need to alter index_lms.html to include jquery library)   .. you just need a variable "TODAYSDATE"  and a javascript trigger with your code.  BUT at the start of it you are missing:  var player = GetPlayer();

    • HenryRYng-d620c's avatar
      HenryRYng-d620c
      Community Member

      oh where you have var player = GetPlayer(); is fine (just in time before you need it) 

  • I know this is a bit of an old thread, but thank you all, this thread definitely saved me some headache today!

  • Instead of pasting code into published HTML you can inject it into the HTML directly from Storyline using WebObjects to add the needed HTML. This way you never have to watch whether you use story.html ( for Web publishing ) or index_lms.html ( for Scormbased LMS publishing ). Storyline on publish automatically picks the correct file with this approach.

  • Update, just paste the Jquery in the "index.lms.html", no need to paste it into the story.html. It will work :)

    • RebeccaPartr679's avatar
      RebeccaPartr679
      Community Member

      Hi, I know this is an older thread but I am having the same issue with a date javascript in my LMS. I am very new to storyline this is my date code. Where would I add the index.lms bit please? 

      var currentTime = new Date();
      var month = currentTime.getMonth() + 1;
      var day = currentTime.getDate();
      var year = currentTime.getFullYear();
      var dateString = day + "/" + month + "/" + year;
      var player = GetPlayer();
      player.SetVar("TODAYSDATE", dateString);

  • IT WOOOOORKS !!!! Thank you Russell !!

    For the ones who need help, you just have to add the jquery in the "story.html" before the </head> (around line 14) and "index.lms.html" before the </head> too (around line 16).

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  • Hello, thank you Luciana and Russell ! 

    I've already uploaded it in scormcloud but it never worked, nothing appears and I still have the same error message.

    I'll have a look on what you said Russell and will be back to you soon ! Thank you a lot for your help :)

  • Hello Ayse,

    I took a quick look at story.html and could see that you added in jquery.

    But when publishing for LMS, you will also want to add jquery to index_lms.html

  • Hello Pooja!

    Thanks for letting us know that you’re running into a similar issue.

    If you’re experiencing an issue in your LMS, please upload your .story file to SCORM Cloud to see if you are able to replicate the issue.

    If you are unable to replicate the issue, please follow up with your LMS team. If you are able to replicate the issue, please share your .story project file so we can investigate what’s happening. You can share it publicly here or privately with our support engineers. It will be deleted when troubleshooting is complete.

  • Hello Ayse, and welcome to E-Learning Heroes. :blush:

    I appreciate you sharing the details of what you are experiencing with your published file. While I cannot provide JavaScript help, I did upload the .zip file to SCORM Cloud so we could determine if there was an issue with the file or with your LMS.

    Here’s a link to the published output on SCORM Cloud if you would like to take a look.

    My image looks different than yours, which indicates it’s working in SCORM Cloud, so I’d recommend following up with your LMS Team.