Forum Discussion
WebObject and Storyline Variable
For future reference for others, you can do to it like this for html5. In the slide where the webobject exists, create a new Javascript that starts at the beginning of the timeline. The script below is my interpretation of how to solve the OP's problem:
// Find and change the src part of the iframe (this will take the first webobject in the storyline, therefore [0]. If you want the second one, use [1], etc..
var iFrameElem = document.getElementsByClassName('item webobject')[0];
var src = "http://mywebobject.com/mysite.php"
var player = GetPlayer();
var var1 = player.GetVar("info1");
var var2 = player.GetVar("info2");
// Add together the finished url with querystrings
var finishSrc = src + "?info1=" + var1 + "&info2=" + var2;
iFrameElem.setAttribute('src', finishSrc);
- JacquiDyach8 years agoCommunity Member
Thanks, Linus!
This worked, but I had to change the class from 'item webobject' to 'item webobject unhideable', as the containing div also uses the class 'item webobject'.
I was not initially clear, but the order of the web object [0] for first, [1] for second, etc. is specific to the slide, and not the entire project.
I am using Storyline 2, Update 11.