Javascript code for closing the current window

Feb 24, 2016

I'm adding an "Exit" button in the tabs area of my Storyline 2 project. I'm looking for the javascript code to do this. I've tried window.close(); when the user clicks but it doesn't seem to work. I've tried window.print(); just as a check and that works. Can anyone help me out? Thanks. Lou

3 Replies
Leslie McKerchie

Hi Lou!

Articulate Storyline supports JavaScript triggers, letting you extend the functionality of your courses. Although we don't provide support for JavaScript coding, we do have this article that will help when you're developing JavaScript triggers in Storyline.

Hopefully someone in the community will be able to pop in and assist with your particular question.

Kenneth Minnich

Hi Lou. If your course is opening in a new window, use self.close(); instead of window.close();

This is because window.close(); is intended for windows opened using the window.open(); method. So that command would fire from the original window that opened the course rather than from within the course itself. Self.close(); will close pop-up window containing the course. 

I've tested this in SL360. Hope this helps. 

-Ken

This discussion is closed. You can start a new discussion or contact Articulate Support.