Dynamically creating a web object

I'm using the following javascript in a trigger when the timeline of a slide starts:

var player=GetPlayer();

var location=player.GetVar("Location");

var country=player.GetVar("Country");

var ha=player.GetVar("HealthAuthority");

var role=player.GetVar("Role");

var customURL="http://surveys.phsa.ca/s/hip/pretest/all/?location=" + location + "&country=" + country + "&ha=" + ha + "&role=" +role;

OpenWebObject(1,customURL,10,52,780,538,245,52);

The idea is to append SL2 variables to a url, and then to open that URL in a web object. I'm trying to send storyline-captured data to a fluid survey.

I find it only works if there is already a webobject on the slide, and this needs to have a fixed URL (e.g. http://surveys.phsa.ca/s/hip/pretest/all/). When I publish this, I can see my user-generated URL, but it is immediately hidden by the hard-coded webobject (i.e. two web objects appear on the same page).

If I remove the fixed url web object, I see nothing - ie. the javascript doesn't create a web object on the fly.

Can anyone advise? 

1 Reply
Dave Cox

Where are you sending your custom URL to? Are you sending that back to Storyline or to a custom javascript function?

From your explanation It appears that OpenWebObject() is a javascript function. If so, you just need to debug your javascript. Try using F12 to display the console in your browser, and use the javascript function console.log("URL: " + customerURL); to display your customer URL in the console. This way you can check to be sure it is valid.

You can also use window.open() to open the url in a new window.