Forum Discussion

TracyCowan's avatar
TracyCowan
Community Member
4 months ago

Local Storage Issues

Howdy, I am trying to transfer user variable data between tabs during the same browser session. I have a published folder and in the story_content folder there are 2 other published storyline course folders (course1 and course2). The main course opens in a new window. The branching in the main course works fine. When I click the course1 button , course 1 plays. I set a local variable in that course so when it is completed the variable changes to true. It closes when I click the close button. The main branching browser window is buried under other open windows and shows that the local storage vaiable changed to true. This I did by using setInterval to test for when the variable in course1 changes.  No triggers that are set to fire when the variable changes are working. The course2 button does not become active. Also I have the clearInternal in the javascript so when the variable is true the interval will stop, but that is not working either. I put the course in scorm cloud - ScormCloud link

  • if you read the local storage

    you get the string "true" or "false"

    in your script you use boolean compare

    change the line - add two quotes

    if(Fam_completed == "true") {

     edit:

    • you should check the storyline variables - are they "Text" (string) or "True/False" (boolean)
    • the data types must match between storyline / javascript / localStorage
  • In SCORMCloud, we can try it out, and see if it does what you say it does. But if you want to know why, you can attach the .story file here. If someone can look into it, it is a lot easier to help.

  • if you read the local storage

    you get the string "true" or "false"

    in your script you use boolean compare

    change the line - add two quotes

    if(Fam_completed == "true") {

     edit:

    • you should check the storyline variables - are they "Text" (string) or "True/False" (boolean)
    • the data types must match between storyline / javascript / localStorage
    • TracyCowan's avatar
      TracyCowan
      Community Member

      Thank you so much, that worked perfect. I knew it was something simple.
      I was wondering if there is a way to bring the original window back into focus when the child window closes? Any suggestions would help tremendously.

      Thank you,

      Tracy Cowan
      Sr Content Developer
      Southwest Airlines University
      tracy.cowan@wnco.com

      [cid:image001.png@01DAE8DE.E91EBB20]

      ******* CONFIDENTIALITY NOTICE *******

      This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message from your system. Thank you.

      • StevenBenassi's avatar
        StevenBenassi
        Staff

        Hi Tracy!

        Glad to see Walt and Jurgen have been helping you with your Javascript request!

        I just wanted to share that part of your e-mail signature came through when you replied via e-mail. This Peek video will show you how to edit it out if you’d like!