Copy link to clipboard
Copied
In order to support a strict content security policy, I need to replace the inline onclick, etc., events with "addEventListener". I am having limited success when modifying "constructDIVs()" in index_scorm.html. (If there is a way to do this without editing the HTML files, I would love to hear it.). Thanks in advance.
function constructDIVs() {
if(lCSSLoaded && lJSLoaded) {
initializeCP();
// my additions here:
// no error
document.getElementById("div_Slide").addEventListener("click", cp.handleClick(event));
// no error
document.getElementById("playImage").addEventListener("keydown", cp.CPPlayButtonHandle(event));
// fails
document.getElementById("playImage").addEventListener("click", cp.movie.play());
// fails
document.getElementById("cc").addEventListener("click", cp.handleCCClick(event);
// no error
document.getElementById("ccClose").addEventListener("click", cp.showHideCC());
}
}
All envent handlers were copied directly from the document.innerHTML statement, so I'm not sure what is going on here.
playImage returns: index_scorm.html:147 Failed to execute 'addEventListener' on 'EventTarget': The callback provided as parameter 2 is not an object.
FYI, I displayed the value of cp.movie, and it was "[object Object]".
cc returns: index_scorm.html:155 Failed to execute 'elementFromPoint' on 'Document': The provided double value is non-finite.
Have something to add?