Phaser Offline. How to do it?

Recommended Posts


How to use Phaser with full power on offline devices? My game is not an online only experience...

How to get working?




In a close future there will be a mobile app friendly version of Phaser? So we can distribute with PhoneGap, CocoonJS, etc...



Thank you!

Share this post

Link to post
Share on other sites

Nothing has to be online to use phaser. You have the full power of phaser in the javascript file phaser.js

If a mobile or tablet plays a game made with phaser then you would already have the phaser file in the source code so it would work no matter what. With or without internet connection.

If you wanted to test your phaser games offline without needing to use a host for you game then you have a few choices:

WAMP server - localhost


Both them options allow for offline testing but I'm sure that is said in the getting started guide for using phaser.

Hope this answers your question :)

Share this post

Link to post
Share on other sites

If you use NetBeans and click on the Play button it will simulate a server, so you can test your games offline. But there are many other possibilities too, but I think this one is the easiest.

Share this post

Link to post
Share on other sites

Firefox will run most things from a local drive, if you just want to try things.  Chrome is stricter. 



Clone the phaser examples github and open it the index.html in Firefox, *most* examples work.   

Share this post

Link to post
Share on other sites

I've tried to develop game in Phaser just by opening it in browser (without local http server) but I've got an error:

The cross-origin image at file:///C:(...) may not be loaded. p


To overcome this problem I've launched Chrome with flag "--allow-file-access-from-files" and for the time being it works like a charm.

For Firefox there is similar option in about:config.


My game is very, very simple so there is a chance that some new errors will appear in more complex projects but for me this is enough.


Please let me know if this work for you and if you have noticed any problem with this approach.

Share this post

Link to post
Share on other sites

Hi all,


I found this link a while back. Not sure if the  writer already posted his solution in this forum, but  I'll link to his blog from this thread in case it may help someone in the future:



Kevin Sloan / February 9, 2014
The Phaser engine forces you to load your app in a web server because it uses Cross-Origin-Resource-Sharing to load assets. This is a problem if you want to run your HTML5 game locally or wrap it up and run it in a native PhoneGap App.
The solution for me was to simply encode the sprites/audio I was using in base64 and include that in my js. I only had to change a few lines in the Phaser.Loader module: = file.url;
// = this.crossOrigin;
// = this.baseURL + file.url;
Then instead of passing in the URL to the file, pass in the data itself like so:
game.load.spritesheet('birdie', 'data:image/png;base64,'+
'gtgAAAAASUVORK5CYII=', 24, 19)
You can use the same trick to load audio and other assets if you need too. Just read over that switch to see the ways Phaser loads each filetype, and replace it with the data. Obviously this is a quick fix, but it did everything I needed.
<end quote>

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.