Skip to main content
Inspiring
February 24, 2016
Question

Scope of javascript in Captivate script windows

  • February 24, 2016
  • 1 reply
  • 652 views

I'm obviously missing something fundamental here.  I found an example which purported to be an implementation of cookies in Captivate, which involved appending some javascript to standard.js in the Templates/Publish subfolder under Captivate's area inside Program Files on my machine.  But I couldn't get it to work.  That's one problem:  Captivate didn't seem to know about any of that code in the published project.

So then, I thought, OK, I'll actually copy and paste the code right into the On Enter action on slide 1 where, in the original example's Captivate file, there was already a script doing part of the work of trying to generate and retrieve the cookies.  I thought "surely THIS will work".  Well, none of it works.  Sitting at a pause in slide 1, I used the Console in Chrome to try to find any of the functions or the single var I tried to create on entry into slide 1 attached to the window object, but none of them were there!  Which drives me to ask:  what is the scope of the code entered into a script window?  I would have thought it would add those objects to the window object for at least SOME period of time.  Does it work at ALL to define global functions/variables in there?  If so, how long will they persist?  Where am I going wrong?  Someone please clarify this issue for me!

This topic has been closed for replies.

1 reply

RodWard
Community Expert
Community Expert
February 25, 2016

Are you testing this from a localhost or web server environment?  If not, try doing that.  You may be running into browser security issues.

Inspiring
February 25, 2016

I'm testing from a localhost environment.  Also, it's unclear from what you said which one you meant me to try, from a localhost or a web server environment...........

TLCMediaDesign
Inspiring
February 25, 2016

The script you are trying to execute depends on CP version and html5/swf. It seems like you are using swf since you are trying to update the standard.js.