Email content using javascript (Close window)
Jul 17, 2019
I'm using the below javascript to send an email from storyline. It works as expected, but a new tab/window opens when the javascript runs. How do I eliminate the new browser window from opening but still execute the javascript? All of our learners will use Outlook.
var player = GetPlayer();
var email=player.GetVar("useremail");
var subject="Voicemail Script";
var body_start=new Array();
body_start[1]=player.GetVar("Greet1");
body_start[2]=player.GetVar("CRF");
body_start[3]=player.GetVar("CRQ");
body_start[4]=player.GetVar("Closing");
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start.join(" ");
win=window.open(mailto_link,'emailWin');
1 Reply
Hello Aimee,
I didn't know Storyline could be use to do those all those javascript things! I browsed the web and find this: https://stackoverflow.com/questions/13457684/how-to-prevent-mailto-event-from-opening-a-new-tab-in-browser
So you have to replace the line
win=window.open(mailto_link,'emailWin');
by this
window.location.href = mailto_link;
This discussion is closed. You can start a new discussion or contact Articulate Support.