External files ignored after export to HTML5?

0 favourites
  • 5 posts
From the Asset Store
Jump on the mole rats and see how far you can go!
  • I added 2 simple text files to a project who's contents I want read in at launch time. This set up works fine when running the project in the Construct editor.

    But when exporting to HTML5, it seems the text files are ignored because any changes I make to them never appear in the project running in a browser. In fact, the original file contents seem to be included in the exported project somehow.

    I know I'm missing something here, but what? How do I enable an exported project to read in the contents of external text files at launch?

    (the project is running on a local server under localhost and, aside from the external file issue, runs as expected)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Project files are included with an exported project. If you want to access an external file, use AJAX to request it (for a web export). Alternatively, nw.js can access a local filesystem.

  • oosyrag. Thanks for the response.

    I am using AJAX to retrieve the data from the text files. And when exporting as HTML5, the text files are exported along with the rest of the project files. But when running in a browser on a server, the project doesn't appear to access the text files, because if I change the data in either of the files and force-reload the browser, the Construct text contents don't change.

    I set up a simple project that shows what I'm doing:

    dropbox.com/s/reoz4nifpqqfhsa/FileTest.c3p

    What do I need to change?

    [ UPDATE ]

    After trying some alternatives, I determined clearing the browser cache seems to solve my problem. So apparently I need to add some code in the index page to disable caching.

  • The offline cache will save copies of the files. To update your game you must re-export and re-upload the project, as described in Offline games in Construct.

  • Thanks Ashley.

    So following the logic explained in the article, it seems I should be able to manually edit the timestamp in offline.json, save the file along with edited text files, re-upload to the server, and then refresh the browser to get the new content. Trying this doesn't seem to work, but I'm hoping maybe it's possible?

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