We have a “framework” which will load up html files, i.e. ones built in Saola, and display them. We also have some functions in the “framework” that I need to call, lockNext() and unlockNext(), which will enable or disable the Next button in then navigation area.
In Saola I have a javascript function, addToClicks, which will keep track of the total number of buttons that have been clicked. Then when certain conditions are met, I need to call unlockNext();
How do I call functions outside of Saola ?
These functions,along with other things, and some jQuery, are in a javascript file which are called from the html file - <script src="js/framework.js"></script>
You can call any public functions in framework.js via the global object of the framework.
If the framework and Saola Animate HTML5 are embedded into the same HTML document, they share the same global window object. You can call framework functions such as lockNext(), unlockNext() directly from Saola Animate.
If Saola Animate HTML5 is embedded into an iframe in the HTML document that contains framework.js, the framework global window object is the parent of the HTML5 global window object:
// in Saola Animate
var frameworkWin = window.parent;
frameworkWin.lockNext();
You can see this tutorial for more information about embedding Saola Animate HTML5 directly or through an iframe:
Oh wait. It was running from the desktop not from the server. I think that’s why I was getting ““DOMException: Permission denied to access property “lockNext” on cross-origin object”” error.