Forum Discussion

HannaGebert's avatar
HannaGebert
Community Member
10 months ago

Java Script for an e-mail

Hello everyone,

I am looking for a Java Script block for a ready-made e-mail with a subject and a text. So the learner clicks on a button in Storyline and then a prepared e-mail should open, so that one only have to send the e-mail without writing a text.

Does anyone have such a block and can help me with this?

Thanks a lot in advance!

Greetings, Hanna.

  • DaanGroen's avatar
    DaanGroen
    Community Member

    Does this work? (i'm also new to Javascript)

     

    var subject = "Your email subject here";
    var body = "Your email body text here";

    var mailtoLink = "mailto:?subject=" + encodeURIComponent(subject) + "&body=" + encodeURIComponent(body);

    window.location.href = mailtoLink;

  • SBP_Inc's avatar
    SBP_Inc
    Community Member

    Nice answer Daan.

    One point worth noting for future readers - this code requires the learner's system to have an email application installed, so the code does require some testing