How do I Disable the disable html5 file:/// protocol check

0 favourites
  • 6 posts
From the Asset Store
Source code, art assets and music tracks to remake this game
  • Hi, When c2 project html5 is exported, I'm not able to run it locally because c2 [1] checks for file:/// protocol and won't allow run. How can I disable this behaviour?


    <div id="c2canvasdiv">

    <!-- The canvas the project will render to. If you change its ID, don't forget to change the

    ID the runtime looks for in the jQuery events above (ready() and cr_sizeCanvas()). -->

    <canvas id="c2canvas" width="1280" height="720">

    <!-- This text is displayed if the visitor's browser does not support HTML5.

    You can change it, but it is a good idea to link to a description of a browser

    and provide some links to download some popular HTML5-compatible browsers. -->

    <h1>Your browser does not appear to support HTML5. Try upgrading your browser to the latest version. <a href="">What is a browser?</a>

    <br/><br/><a href="">Microsoft Internet Explorer</a><br/>

    <a href="">Mozilla Firefox</a><br/>

    <a href="">Google Chrome</a><br/>

    <a href="">Apple Safari</a><br/>

    <a href="">Google Chrome Frame for Internet Explorer</a><br/></h1>





  • You need to define what you mean by locally.

    If you try to start the index.html, and you get a warning , that is C2 telling you that using it outside a browser is a bad idea.

    If it doesn't run, or you get some other error then your system is set up to not run scripts which is a good idea.

    If you want to run the file after export, you can google how to setup a server on your own system, or upload it to a host, or portal like the arcade.

    There are many different ways to go, but again running a plain html5 game on the desktop is a bad idea.

  • The message is correct: the game won't run from disk. Removing the error message won't fix this, you'll just have a broken game that does not tell you why it's broken.

  • Well, I have created a simple android app. In the assets folder. In the assets folder, I have dropped-in all the c2 html5 exported files. Next, for my webview, I have enabled javascript and set the setWebChromeClient and the setWebViewClient. When I try to run the app, I get a message that says: "Exported games won't work until you upload them. (When on the file:/// protocol, browsers block many features from working for security reasons.).

    Above also happens when I directly run that from a computer.

    I just want to disable this default behaviour.

  • You should use the Cordova export for Android-based apps using a webview, not the HTML5 export (which is designed for websites). Cordova already does all of that as well, so you only need to build it - no need to write the webview integration yourself.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, I think I got it resolved. The issue with exporting for Cordova and then using XDK is that the generated .apk gets too large; about 30mb. For those interested, here is what I did:

    1. Export for Amazon - select option to run on own server

    2. Created a simple Android app that basically has a webview and loads index.html as shown below. Built the .apk and instead of a .30mb .apk, I now have 5mb .apk for my sample app:





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