Z
Z
zugzug2014-09-28 12:31:02
JavaScript
zugzug, 2014-09-28 12:31:02

What game JavaScript frameworks allow you to include resource files without a call to the server?

Hello. I'm looking for a framework for game development in JS. But the same problem arises during development: the browser does not allow the code to open and generally work with files in the local file system.
Let's say an example with the Phaser.js framework or Quintus :

Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///C:/racemath/data/sprites.json'.

How then is this supposed to work on a mobile device without internet, or if I want to debug locally and don't want to raise any server providing files to the java script?
And the second question: are there any frameworks that allow you to still connect resources from files, or does it all come down to the very problem of preventing access to the OS file system from the browser? Then I don’t understand at all how you can make a game ported to mobile devices, which in theory does not need any access to the Internet, it is self-sufficient with all its internal resources and executable code, after all ..
Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Push Pull, 2014-09-28
@deadbyelpy

XMLHttpRequest - http protocol, you have file://
In chrome, there is a flag to allow work using the file://
protocol --allow-file-access-from-files
Running with this flag will allow XMLHttpRequest to work locally.
- are there any frameworks that allow you to connect resources from files
?
There is one more feature, not always, but changing the creation of XMLHttpRequest from asynchronous to synchronous helps. (and this is also a recipe for smartphones, because there are no flags there)
If none of the above helps, run applications from a local server to develop an application, file:// will change to http:// and it will be ok.
In a mobile application, you can also run the server as a host, but I think there will not be such problems there to bother like that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question