Run Phaser without a Web Server

Run Phaser without A Web Server

Phaser is an excellent and powerful JavaScript game engine.  Normally phaser runs from a web server and for security reasons will not work correctly if you try to run it from your local file system using a web browser.

This is fine if you are ready to host your games on the web, but what if you just want to develop or experiment with phaser on your local machine and dont want the hassle of installing and configuring a web server.

Here is an extremely useful and quick work around!

Chrome to the rescue 1.  Download Google Chrome for free from google.com.
2.  During installation allow it to create a shortcut icon on your desktop.
3.  Make a new copy of the shortcut and rename it, (for example: ‘chrome with file access’).
4.  Next right click your newly created icon and select ‘properties’.
5.  Find the ‘target’ box and add –allow-file-access-from-files to the end of it.  It should now look similar to this  “C:Program Files (x86)GoogleChromeApplicationchrome.exe” –allow-file-access-from-files.

target box

Thats all!  You can now use the full power of phaser from files saved anywhere on your computer. A note on safety.
The reason phaser won’t work (or work fully) when running from local files is due to the fact that web browsers by default do not allow JavaScript code to access your local file system.  This makes a lot of sense as it prevents people using JavaScript code from executing and stealing your data when you access their website.  For this reason we recommend you use caution and not use this shortcut for everyday browsing.

Don’t forget to send us a link to any exciting new projects your creating!