Copy link to clipboard
Copied
Hi all,
looking for some guidance. I am trying to call a js function from within captivate to an external js function on the page.
i have a button on a slide which evokes a function, save();
On my html page where the captivate presentation resides, I have a script and a js function called save();
However, the function is not called. I get an error on the console saying save(); is undefined when i click the button on the slide.
I m thinking I may have to add the script on the html page of the captivate project after its published, but i thought my way should work. Any advice?
Copy link to clipboard
Copied
Hi Mufakkir,
from within Captivate try to call your function with
window.save();
But actually, consider naming your external function with a more securely unique name, like saveMyData or something along these lines instead of using such generic functional names like open, save, copy etc.
Klaus
Copy link to clipboard
Copied
Thanks Klaus. Will try it out. By the way the save(); name was just an example. My actual function is called something different.
Thanks
Copy link to clipboard
Copied
window.save(); does not work either. The actual function is saveCaptivateData(); but same issue as before. The error now is window.saveCaptivateData is not a function.
Copy link to clipboard
Copied
Is the script included in the JS file wich is created in the output folder, or did you include it perhaps in the HTML file?
Copy link to clipboard
Copied
Hi Liybiri
Copy link to clipboard
Copied
I think if your Captivate course is embedded in some parent page, and your function resides there, you'd have to call your it from within the course as parent.save();
Won't work cross-domain, though.
Copy link to clipboard
Copied
Hi Gaanf,
Thank you so much. Parent.save(); works.