Forum Discussion

DavidKelling1's avatar
DavidKelling1
Community Member
10 years ago

Opening a Web Object with JavaScript in HTML5

I need to open a web object with JavaScript because I need to construct the URL for the web object based on information I'll retrieve, so I'll use JavaScript to glue together the final URL and then use JavaScript to launch the web object since you can't use variables in the simple Insert Web Object feature.

Attached is a bare-bones instance of opening a web object with JavaScript. When you publish it, it works; You see the Articulate logo in the player, but only when viewing in a browser that uses Flash.  Here is the JavaScript:

var player = GetPlayer();
var logourl="https://www.articulate.com/images/logos/articulate-nav.png";
OpenWebObject(999,logourl,100,100,300,100,200,80);
var oWebObject = g_oWebObjects["999"];
oWebObject.Div.style.zIndex = "900";

I got the 3rd line from this post: https://community.articulate.com/discussions/articulate-storyline/webobject-and-storyline-variable 

I got lines 4 & 5 from this post: https://community.articulate.com/discussions/articulate-storyline/using-javascript-to-open-a-web-object (You can't see it if you don't change the zIndex.)

As the first post above says, it doesn't work in HTML5, and later in that post a method is suggested but I can't figure out how to make it work.  Since that post has a couple of different tangents in it and is a bit old, I thought I'd start fresh.

Thanks in advance for looking and considering suggesting a solution on how to open a Web Object using JavaScript and have it work in HTML5.

7 Replies