Web Hosting by Facebook

Games on Facebook now offers you a way to upload your games' client code directly to Facebook instead of hosting it on your own or other third-party servers. It's a new, free, and easy way to reach millions of players using the same fast and reliable infrastructure that powers Facebook photos and videos.

Hosted games will continue to use iframes to deliver the experience, but you will no longer need to specify a Facebook Web Games URL to use them. Simply upload your assets, and we will take care of publishing and updating your Facebook Web Games URL internally.

Learn more about how Facebook games use iframes with external hosting here.

In your App Dashboard, under Products, there is a new tab titled Web Hosting. Note that your app needs to be categorized as Games in order to add this product.

Under this tab, you can find everything you need for uploading and managing your game assets. Currently, we support common web assets such as html, css, and image files including these additional highlights:

  • HTML5-supported media (html, css, images, etc)
  • Applications built using Unity's WebGL build target

Please note the following restrictions on these uploaded apps:

  • Server-side logic (e.g. php) is not supported.
  • The total size of uploaded files may not exceed 5 GB for Gameroom and 200 MB for Instant Games.
  • The number of files inside a single app upload may not exceed 500.
  • Public players will not be able to access your hosted game until your application has been approved through the game review process.

Step 1 - Select an Application Type

From the Hosting tab, select a Hosting Type appropriate for your type of application:

Currently only two types of applications are supported: HTML5 web applications, and Unity's WebGL. The separate Unity WebGL type enables some additional target-specific optimizations and features that do not affect regular web applications.

Step 2 - Upload Your Game

HTML5

HTML5 applications are served as a zip archive, with the same constraints as Unity's WebGL. Loading the game invokes the index.html in the root of the zip archive.

It's very important that the generated index.html file is located at the root of the zip file, as this is the only place we can launch the content. All other URLs need to be a relative path.

./index.html

Resources may be placed anywhere in the directory structure, as long as they are referenced relative to index.html. For example, the following file:

./assets/splash.png

must be referenced as:

<image src="assets/splash.png"/>

While the query parameter signed_request is available to Javascript through document.documentURI, we strongly recommended you instead use the Javascript SDK to perform all login and identity operations. Read more about JavaScript login.


WebGL Games by Unity

The WebGL build target from Unity can be zipped up and uploaded directly.

It's very important that the generated index.html file is located at the root of the zip file, as this is the only place that content will launch from. All URLs should be a relative path.

With Unity 5.1, this is a zip archive containing the following:

  1. index.html
  2. Compressed/*gz
  3. Release/*
  4. TemplateData/*

You may handle user login with the Unity SDK. The Facebook for Unity SDK is supported in the WebGL build target. Read more about the Facebook for Unity SDK.

Step 3 - Enabling Hosted Content

Newly uploaded assets are shown with a Processing status. This process take 15-90 seconds to prepare and scan the assets. After this finishes, your asset will transition to a Standby status.

In order to use the assets in your application, you can select the Push to production button for the uploaded asset row.

Selecting Push to production will update the asset to the Production status. Test applications' assets will be shown with a Testing status.

If this is the first time your application will use hosting, you must also enable Simple Application Hosting from your application's Settings tab.

This will switch your application from using a Facebook Web Games URL to using the assets uploaded on the Web Hosting tab. You may disable Hosting and switch back to your Facebook Web Games URL at any time by toggling this option off.

Step 4 - Request a Game Review

At this stage of development, developers and other account roles for your game will be able to play and test your game.

However, before general players can access your hosted game, it must first be approved for App Center listing. If your game is already listed in App Center, you do not need to perform this step.

Start your game review submission through the App Center tab in the App Dashboard. More information here.

Additional Requirements / Known Issues

  • Assets for your game hosted via Web Hosting should only be accessible through Facebook. You may not link to these assets from external sites or applications.