Skip to main content

Response from Game Server to Gadget Server

Screen Transitions​

All links used in screen transitions within the content must pass through the Gadget server.

The Gadget server URL is as follows.

  • Sandbox environment

    `http://g[Application` ID].sb.sp.pf.mbga.jp/
  • Production environment

    `http://g[Application` ID].sp.pf.mbga.jp/

GET:

<a href="?url=http%3A%2F%2Fexample.com%2F">link</a>
  • Setting using an absolute path (http://...) (Example: When the application ID is "100001" in the Sandbox environment)

    <a href="http://g100001.sb.sp.pf.mbga.jp/?url=http%3A%2F%2Fexample.com%2F">link</a>

POST:

<form method="post" action="?url=http%3A%2F%2Fexample.com%2F">
<input type="submit" value="send" />
</form>
  • Setting using an absolute path (http://...) (Example: When the application ID is "100001" in the Sandbox environment)

    <form method="post" action="http://g100001.sb.sp.pf.mbga.jp/?url=http%3A%2F%2Fexample.com%2F">
    <input type="submit" value="send" />
    </form>

or

<form method="post" action="">
<input type="hidden" name="url" value="`http://example.com"` />
<input type="submit" value="send" />
</form>
  • Setting using an absolute path (http://...) (Example: When the application ID is "100001" in the Sandbox environment)

    <form method="post" action="http://g100001.sb.sp.pf.mbga.jp/">
    <input type="hidden" name="url" value="`http://example.com"` />
    <input type="submit" value="send" />
    </form>
  • The url parameter must be URI-escaped.

  • All other links are converted through an intermediate page by the Gadget server.

Displaying Images​

Images can be displayed in the content by writing ordinary HTML. When an image is displayed on the user's mobile device, it is automatically changed to a Gadget server URL by the Gadget server.

<img src="http://example.com/image.gif" />

Normally, an Authorization header is not appended to a request for an image file from the Gadget server to the game server. If you want to append an Authorization header to evaluate the validity of the request, include signed=1 in the query parameters.

<img src="http://example.com/image.gif?signed=1" />

Image files are cached as much as possible in the production and sandbox environment. If this causes problems, include nocache=1 in the query parameters. To update an image file that has been cached, either change the filename in the URL or assign a query parameter.

If you want to use a 1dot transparent image, you can use following image on our platform.

<img src="http://ava-a.mbga.jp/i/dot.gif" />

Displaying Flash Content​

Flash content can be displayed by writing ordinary HTML, in a similar manner just like when displaying an image. Similarly, when flash content is displayed on the user's mobile device, it is automatically changed to a Gadget server URL by the Gadget server, and will be distributed to the user as a Gadget Server domain.

  1. Interactive playback
<a href="?url=http%3A%2F%2Fexample.com%2Fflash.swf">Flash playback</a>
  1. Inline playback
<object data="?url=http%3A%2F%2Fexample.com%2Fflash.swf" type="application/x-shockwave-flash" width="200" height="40">
</object>

If a Flash player is not installed on the mobile device, ExGame can be used.

<html>
<head>
<script type="text/javascript" src="?url=http%3A%2F%2Fexample.com%2Fjj.js"></script>
<script type="text/javascript">
window.onunload = function() {};
window.onload = function() {
var container = document.getElementById("container");
var jj = new JumpinJack("?url=http%3A%2F%2Fexample.com%2Fflash.swf", container);
};
</script>
</head>
<body><div id="container"></div></body>
</html>

Service Tag​

Social features provided by the platform can be accessed by including special links within the HTML. For example, for the diary writing feature, if the reserved word diary:self is entered for the href attribute of the anchor tag, the Gadget server will replace it with a link to the platform's diary feature to implement the feature.

例

<a href="diary:self?url=http%3A%2F%2Fexample.com&subject=%83e%83X%83g">Write diary</a>

Notes Concerning JavaScript​

  • When using onclick in the body tag
    • When sharing Shell App Framework and a game server on a smartphone, this might be viewed in WebView, or it may not work at all so make sure that it is specified in a div tag as follows.
# Before <incorrect usage>
<body onclick="...">
...
</dody>

# After <correct usage>
<body>
<div onclick="...">
</div>
</body>
  • To generate or send the URL using JavaScript, make sure to always pass through the Gadget Server as follows.

Sandbox environment

`http://g[Application` ID].sb.sp.pf.mbga.jp/?url=[URI-escaped URL to be sent]

Production environment

`http://g[Application` ID].sp.pf.mbga.jp/?url=[URI-escaped URL to be sent]

HTTP Response header that can be set​

Following HTTP response headers are available. Response header other than below, can be removed by the Gadget server.

Redirect​

  • Location
    Example)

    Location: http://example.com/path/to/redirect
    note

Specify the URL directly to the game server in Location header. :::

Cross-Origin Resource Sharing​

  • Access-Control-Allow-Origin
  • Access-Control-Allow-Credentials
  • Access-Control-Expose-Headers
  • Access-Control-Max-Age
  • Access-Control-Allow-Methods
  • Access-Control-Allow-Headers
  • Origin
  • Access-Control-Request-Method
  • Access-Control-Request-Headers
     
    Refernce)
  • http://www.w3.org/TR/cors/

Revision History​

  • 04/25/2013
    • Added "HTTP Response header that can be set"
  • 03/15/2013
    • Document migrated
  • Screen Transitions
  • Displaying Images
  • Displaying Flash Content
  • Service Tag
  • Notes Concerning JavaScript
  • HTTP Response header that can be set
  • Revision History