How do I Run an Embedded HTML iFrame on Android?

1 favourites
  • 4 posts
From the Asset Store
Run Vovan Run
$1.60 USD
60% off
Full game Construct 2 and Construct 3 to post on Google Play
  • I have a html file within my project files folder which I get at runtime and uses it as the url for an iframe.

    This works great when I export to the web and run in the browser. However, when I do the exact same thing in an Android debug APK the iframe never seems to get populated with the html. Why could this be?

    I get my html file like this:

    var mainHtml = await runtime.assets.getProjectFileUrl("c3interfacetest.html");
    var response = await fetch(mainHtml);
    runtime.callFunction("OnGotHtmlFile",[mainHtml]);
    

    then the OnGotHtmlFile function runs in the event sheet with the project file as the argument..

    -> myIframe: Navigate to mainHtml

    Like I said, this seems to run fine on the server in a web page but not on device. There are no errors given in the Chrome console.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It seems like the export to the server uses the actual filenames (even they are local to the deployment) eg

    The debugger for the deployed web build (which works) reads:

    File to navigated to= c3interfacetest.html

    ..but the deployed android version debugger (which does not work) reads:

    File to navigated to= blob:file:///c7a3057a-b9a5-49ad-a399-b18bcf5539a9

    So maybe this is the issue?

    But how do I solve it as the blob version doesnt seem to be able to be used in the 'Navigate to' action of the iframe object.

    Something to do with the 'Allow' parameters in the iframe object maybe? or is it a bug? Surely the behaviour should be the same on a device?

    EDIT:

    -I tried adding blob://*/* to the whitelist on export. But that had no effect.:(

    -A also tried using Ajax to get the local file but this had no effect on ANdroid either.

  • Should I report this as a bug?

    Is using project based html files for iFrames supposed to work on Android in the same way it works on deployed Web builds?

    Hopefully someone can guide me, as this is actually the only sticking point for the progress of my current project. Without it, I'm stuffed :)

  • Can I bump this? If I can get this working it will be a game changer and allow me 3d in my C3 games. It works great for web builds but not on device.

    Here is the web test version working http://www.pigobo.com/TestC3/TestV3d_v2/index.html

    You can see its loading an iframe with content using the Verge 3d engine and can send message events to the iframe via JS events. In this case I just hide/show the cube.

    Blue square is a C3 sprite while the message button is a c3 html button. The only downside is that the iframe layer is always above all the C3 elements.

    Now if I could just get this working on Android I'll be able to essentially combine the engines to have the best of both worlds.

    Cheers

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