Using LMScommit and javascript to detect internet connection
Nov 23, 2016
By
Kevin Ngo
What I am trying to do is that once a user clicks a button, 1 of 2 things will happen.
1. If LMScommit returns true (they are connected to the internet), then they will be moved to a success slide.
OR
2. if LMScommit retrns false (they are not connected to the internet, then they will be moved to a failed slide.
The script I am using is,
var player = GetPlayer();
var LMScommit = LMSGetValue("API.LMScommit");
if (LMScommit == "false")
{
player.SetVar("internet", false);
What I want this script to do is, if LMScommit=fail, change variable "internet" to false. However, it is not working.
Help would be much appreciated.
Thank you!
3 Replies
If API.LMSCommit is itself a boolean and var internet is also a boolean, then scrap the if statement and replace the last line with player.SetVar("internet", LMScommit);
Alex
It didn't work :(, I have the script as.
var player = GetPlayer();
player.SetVar("internet", LMScommit);
You should keep var LMScommit = LMSGetValue("API.LMScommit"); and place it right before the SetVar statement.
This discussion is closed. You can start a new discussion or contact Articulate Support.