Javascript link not working

Jul 02, 2019

Hello,

I have javascript code to

1.get the URL of the current page

This is split and put into an array

2. Extract first part of URL

this will be the client name used for there LMS portal

3. Combine to make new URL

This will be added to the final quiz button to take them back to the relevent section of their LMS

This is the part of the code that isn't working, when we click on the link nothing happens.

The attached is a screenshot showing the SL text Vars:

The code is below:

/////////this is called when timeline starts//////////////////////////////////

var player = GetPlayer();

var path = window.location.href;
var array = path.split(".onlineprocurementacademy.com");
var newName = array[0];

player.SetVar("courseExpired", path);
player.SetVar("courseExpired2", array[0]);
player.SetVar("URLClient", newName + ".onlineprocurementacademy.com/course/view.php?name=opra55");

///////////////this is called when user clicks go to quiz button//////////

var url = newName+".onlineprocurementacademy.com/course/view.php?name=opra55";
window.open(url, '_blank');

//////////note: this works if I set var newName = "http://elearning"////////

 If anyone has any suggestions?

regards,

Sharon

 

Be the first to reply

This discussion is closed. You can start a new discussion or contact Articulate Support.