Accessing function of Ionic app running inside an iFrame


#1

Hi guys,

Here i am again with a very specific question.

I’m using a web page and an iFrame to run my application pretty much like in the Ionic documentation.
What i’m trying to do is being able to fire a function that is inside my application from the webpage that is running the iFrame. Any way i could do that?

The final goal being that my client can see a ‘bare’ version of my app (without business logic) and can select colors to personnalise the app to his business. (hence firing a function that would set colors attributes in my running app).

The set up is very basic and mostly copy/paste from inonic doc :

<body>
    <script src="script.js"></script>
    <div id="phone-case">
        <div>
            <iframe id='targetFrame' src=/pathToRunningApp"></iframe>
        </div>
    </div>

    <form>
        <input type="button" value="click" onclick="test()" />
    </form>
</body>
 function test() {
    document.getElementById('targetFrame').contentWindow.<WayToAccessTheIonicFunctions>
}

Regards