Forum Discussion

NatalieFried503's avatar
NatalieFried503
Community Member
5 years ago

Exit course/close browser window not working correctly

I have a storyline 360 file that I am publishing as HTML5 and launching using aws. The issue is that the exit button does not close the browser window. I have adjusted the player settings to launch in a new window and that doesn't appear to be working, either. I know that I need to add JS to make the exit button work but I am not sure of the exact script to add. I am using a Chrome browser to test this, btw. Thanks for any help.

8 Replies

  • JoeFrancis's avatar
    JoeFrancis
    Community Member

    Try changing the Trigger for your Exit button to:

    Execute JavaScript
    When the user clicks Button 2

    In the JavaScript window, enter the following:

    window.top.close();

    • NatalieFried503's avatar
      NatalieFried503
      Community Member

      Right, that's what I've been using but the clicking the button doesn't close the window even with that JS. I assume this is an issue because the page is launched from my Squarespace website, opening in a new tab that is hosted by aws? 

  • JoeFrancis's avatar
    JoeFrancis
    Community Member

    In your code on your Squarespace site, how are you opening the new tab with the course in it on Amazon Web Services?

    • NatalieFried503's avatar
      NatalieFried503
      Community Member

      I have a direct url from my Squarespace site to open the aws in a new window. 

  • JoeFrancis's avatar
    JoeFrancis
    Community Member

    When you open the new tab, do you use a straight HTML link:

    <a href="https://www.google.com/" target="_blank">Go to Google</a>

    or JavaScript:

    <button onclick="Open()">Google</button>

    <script>
    function Open() { 

    window.open("https://www.google.com", "_blank"); 
    }
    </script>

    The reason I ask is because you can only close a tab (window) using JavaScript if it was OPENED using JavaScript.

    • JenniferDang's avatar
      JenniferDang
      Community Member

      Hi, would you mind telling me where to input this code on Squarespace? How do I link it to an existing button so that it opens up to a new tab? I also am linking to AWS. I have already created a javascript trigger to close the browser. Thanks in advance!

      • JoeFrancis's avatar
        JoeFrancis
        Community Member

        You would put the code on the page which you use to launch the published Storyline course(s); pointed to the story.html file.