Forum Discussion
Publish to Flash first to get JS email working??
Trying to get the JS email function to work, I have created a javascript trigger with the simplest possible code, to start an email from SL 360. I tried pasting in the exact code from the help pages (just editing in my email address).
It just does nothing at all, either from Review or when published to web and put onto a server, either on a mac or windows browser.
I read in a post from a few years ago that someone had this issue, and had to publish to Flash first and then to html5, to get it to work. Can't do that now, but does anyone have any recent experience?
- johnfaulkesCommunity Member
A really frustrating update to my earlier post! The simple JS trigger I described in my above post just worked perfectly in Review.
Then I republished to Review after changing some other things. That same trigger no longer works!!
- johnfaulkesCommunity Member
Just some more to report (if you have any patience left). I started this whole thing earlier today by writing a more involved trigger (which didn't work), before I tried out the simple one. What I've established now is that the presence of the more involved trigger stops the simple one working! I have attached a file, in case anyone can shed any light!
- WaltHamiltonSuper Hero
I'm baffled by this, because the scripts are separate scripts, and should not effect one another, but, as they say, "The compiler is what the compiler does."
The third script has a line break after questionnaire, and a mismatched " in the body_start variable.
Here is a version I got to work for me.
var email="john.faulkes@gmail.com";
var subject="Report requested";
var player = GetPlayer();
var body_start="here is a more comprehensive report on this questionnaire"+ player.GetVar("leader_role")+ player.GetVar("effective_communication");
var mailto_link='mailto:'+email+'?subject='+subject+'&body='+body_start;
window.location.href = mailto_link; - PhilMayorSuper Hero
The scripts all get added to a single file user.js so one syntax error will break them all
- johnfaulkesCommunity Member
Thanks very much Walt! And Phil.
I got it working.