How do I call a C2 function from Html ?

  • Hi !

    I need to call a C2 function in JS from my html page.

    I know this question has already been asked, I went through a few posts about this on the forum.

    But I only found a short clear answer : you should make a plugin.

    Is there really no other way to do this ?

    The opposite (calling a JS function from C2) is really easy with Browser.ExecuteJavascript.

    I need to open a custom html login form from C2, and when logged in, I must send back to C2 that "we're logged in".

    I could make an ajax call in C2 every X seconds to check if we're logged in or not, but for me it's not a proper way to do this.

    If I must use a plugin to communicate from my page to C2, is there any demo / tutorial for this ?

    I don't have too much time to implement this feature so I'm looking for the quickest way.

    I know there are plugins like clay.io but I need to keep all the data in my own DB and I don't want any reference to an external service in my forms.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yes, the only way is to make a plugin. It should not be difficult if you have any knowledge of Javascript.

  • When your loginpage is in HTML and not in C2, why don't you just login first and then open the index.html from c2 (Where you could also check if you're logged in).

  • [quote:19o496qz]

    Pass informations from the HTML page to the C2 application - LINK

    From the How do I FAQ

    Some kind of hack, but could be useful.

  • Yes, the only way is to make a plugin. It should not be difficult if you have any knowledge of Javascript.

    Yes, that's what I thought, the plugin system seems to fit my need, but I would have to spend some time to read the plugin documentation, watch some examples, do some tests etc ...

    I'll definitely look into that, but for now I think I'll go for a less elegant but quicker solution.

    When your loginpage is in HTML and not in C2, why don't you just login first and then open the index.html from c2 (Where you could also check if you're logged in).

    Actually it's a game where you can play the first level without being logged in, and then at the end of this first level, you must log in or create an account to continue.

    [quote:12175317]

    Pass informations from the HTML page to the C2 application -

    From the Some kind of hack, but could be useful.

    Interesting, I could use this to know when I have to do my Ajax request from C2.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)