JavaScript help - open new window vs. append existing?

I know this is more of a JavaScript question than a Storyline question, but I'm hopeful there may be a JavaScript guru out there who can answer this question simply.  I have a script (attached) I'm using in a Storyline training, which is intended to open a new window with completion status for a series of sub-sections within the training.  The script works, except... 

It's just recently come to my attention that if a user clicks the button to activate the script, a new window pops up with the contents (just like intended).  However, if the user leaves that new pop-up window open, returns to the training, and clicks the button again, the completion results are appended to that already open window (instead of popping up with a brand new window).  

I am very much an amateur when it comes to JavaScript, so just getting the script to this point is pretty much maxing out my abilities, ha!  I'm sure there's a simple change I need to make in order to have the click produce a new window each time.  Can anyone advise?

2 Replies
Ari Cohen

Hi there Nick,

Thanks for reaching out for help. Looks like a fun project you are working on.

I was able to take a look at your script (thank you for providing this) and see that you are using the JavaScript 'Window open() Method' to trigger the launching of this browser window.

In referencing the w3 school's documentation on this method we can see there are a few parameters available to us. One of these is the 'name' parameter which allows us to set the target attribute or in other words how the windows are opened.

By using the _blank attribute we can force the opening of a new window each time the script fires. I tested this out by adding the parameter and setting it to _blank in a project of my own and found success here.

See where I added _blank below:

var myWindow ="_", "_blank", "Print","width = 810,height = 610,scrollbars = 1,resizable = 1");

You can also see this in action via the video I created here:

I have also re-uploaded the updated script for you to reference as well. Happy to help further if you have further questions.

Happy building!