Copy link to clipboard
Copied
Within the Captivate courses I have a "Web Object" for a JotForms form that the end-user needs to complete before proceeding.
Within Advanced Actions I have:
Conditional Statement - If "cpInfoCurrentFrame" is greater than "30"
Action: Pause
Additionally:
Action: Execute Javascript (Parent)
Javascript:
var iframe = document.getElementById("myFrame_Web_2c");
var innerDoc = iframe.contentDocument || iframe.contentWindow;
var btn = innerDoc.getElementsByClassName("form-submit-button");
btn.addEventListener("click",playCourse);
function playCourse() {
cp.movie.play(cp.ReasonForPlay.PLAYBAR_ACTION);
}
I have received TypeError: Cannot read property 'contentDocument'
when I add a Timeout function I receive var "X" undefined.
Any assistance is greatly appreciated.
Copy link to clipboard
Copied
Are you trying to test this locally?
Without examining your code...
Browsers are real finicky about allowing communication through an embedded iFrame as it is considered a security risk.
If you publish to a bonafide webserver - the browser should detect that both project and iFrame are a part of the same domain and allow the communication to proceed.
Copy link to clipboard
Copied
I have tried locally and within Saba LMS, in both scenarios I receive the following:
TypeError: Cannot read property 'contentDocument' of null
at eval (eval at a.runJavascript (eval at e (CPXHRLoader.js:37)), <anonymous>:2:23)
at eval (<anonymous>)
at Function.a.runJavascript (eval at e (CPXHRLoader.js:37), <anonymous>:862:150)
at eval (eval at executeAction (eval at e (CPXHRLoader.js:37)), <anonymous>:1:245)
at cp.Movie.executeAction (eval at e (CPXHRLoader.js:37), <anonymous>:1184:432)
at cp.Movie.frameBasedExecuteAction (eval at e (CPXHRLoader.js:37), <anonymous>:1185:84)
at a.Timeline.updateFrame (eval at e (CPXHRLoader.js:37), <anonymous>:1065:52)
at cp.Movie._onEnterFrame (eval at e (CPXHRLoader.js:37), <anonymous>:1195:196)
at step (eval at e (CPXHRLoader.js:37), <anonymous>:1174:23)