">mixi Developer Center (mDC)

mixi Apps

mixi Apps (English) » Technical Specification » PC » Moving to Different Views

Moving to Different Views

A mixi App can be run in different pages (e.g. profile page, home page, and applications page). Although each page provides different content and user experiences, users are able to move freely back and forth among the pages.


In OpenSocial, a page where an application is placed is called “view”, and OpenSocial prescribes APIs enables the developer to display an identical view to a user or move to another page without requesting additional input from the user.

Enabling the Views Functionality

APIs related to views are available in gadgets.views. The developer has to define the thing to use the views functionality in Gadget XML file.

<?xml version="1.0" encoding="UTF-8"?>
  <ModulePrefs ...>
    <Require feature="views" />

As shown in the code above, by the Require tag, Views functionality is enabled.

Moving Pages

The developer has to obtain the View information of a landing page by the gadgets.views.getSupportedViews().

var view = gadgets.views.getSupportedViews()["profile"];

In the example above, “profile” is set to specify the user’s profile page. In addition, the following names are supported:

  • profile – Profile page (show_friend.pl)
  • home – Home page (home.pl)
  • canvas – Applications page (run_appli.pl)

The landing page is navigated byc calling the gadgets.views.requestNavigateTo() function.


The View information of the landing page, obtained earlier, can be specified as the argument of the requestNavigateTo(). When the developer is willing to reload the current applications page
(run_appli.pl), it is necessary to obtain the view information by
specifying with “canvas” and to call the requestNavigateTo() with its

Parameter Specification

A certain parameter can be specified for the second argument by using the requestNavigateTo() when moving to the landing page.

var params = {
    image: "12345",
    mode: "edit"
var view = gadgets.views.getSupportedViews()["canvas"];
gadgets.views.requestNavigateTo(view, params);

The parameter can be defined as a property in a JavaScript object. By specifying this object as the second argument of the requestNavigateTo(),the passed parameter becomes retrievable in the mixi App placed in the landing page. The gadgets.views.getParams() only enables the developer to obtain the parameter for the applications page (“canvas” – run_appli.pl).

var params = gadgets.views.getParams();
var image = params["image"];
var mode = params["mode"];
// do something...

Identifying Owner

The owner of the mixi App placed on the landing page can be changed by identifying expressly the owner by the third argument of the requestNavigateTo().

var ownerId = ...;
var view = gadgets.views.getSupportedViews()["canvas"];
gadgets.views.requestNavigateTo(view, null, ownerId);

This Owner changing process is interpreted differently depending on the landing page:

  • canvas – The user specified in ID becomes the Owner of the mixi App.
  • profile – the profile page of the user specified in ID is displayed and the user becomes the Owner of the mixi App placed on this profile page.
  • home – Specifying Owner is ignored.

Besides, if the Owner has already been specified (owner_id=*** is added to URL), the Owner is determined as follows:

  • The Owner when the requestNavigateTo() is called remains same if any Owner is not specified for the third parameter.
  • The specified Owner becomes the Owner, if the Owner is specified for the third argument.