">mixi Developer Center (mDC)

mixi Apps

mixi Apps (English) » Technical Specification (new method) » PC » Preparing for the JavaScript API

Preparing for the JavaScript API

You need to previously prepare for using the JavaScript API as below.

Step 1. Place the following HTML file on the web server in the same domain as the mixi app.

<script>
var u = location.href, h = u.substr(u.indexOf('#') + 1).split('&'), t, r;
try {
  t = h[0] === '..' ? parent.parent : parent.frames[h[0]];
  r = t.gadgets.rpc.receive;
} catch (e) {
}
r && r(h);
</script>

*This HTML file is required for an API that executes a callback, such as the User Flow API. The file cannot be executed as a callback on some browsers if it is not properly edited.

Step 2. Read JavaScript code on the mixi app as shown below.

<script type="text/javascript" charset="UTF-8" src="http://static.mixi.jp/js/application/connect.js"></script> 

Step 3. Execute the format code as below.

mixi.init({
    appId:    "XXXXXXXXXXXXXXXXXXXXXXXX",
    relayUrl: "XXXXXXXXXXXXXXXXXXXXXXXX"
});

The parameter that specifies the mixi.init() functions are listed below.

Parameter Value
appId Consumer Key of mixi Graph API assigned to a mixi app
relayUrl HTML file placed in step 1

 

TOP OF THIS PAGE