Forum Discussion
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
- JoeFrancisCommunity Member
Try changing the Trigger for your Exit button to:
Execute JavaScript
When the user clicks Button 2In the JavaScript window, enter the following:
window.top.close();- NatalieFried503Community 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?
- JoeFrancisCommunity Member
In your code on your Squarespace site, how are you opening the new tab with the course in it on Amazon Web Services?
- NatalieFried503Community Member
I have a direct url from my Squarespace site to open the aws in a new window.
- JoeFrancisCommunity 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.
- JenniferDangCommunity 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!
- JoeFrancisCommunity 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.
- NatalieFried503Community Member
Brilliant! Yes, that solved it. Thanks so much.
Related Content
- 2 years ago