All Products
Search
Document Center

Mobile Platform as a Service:Start other applications

Last Updated:Jan 28, 2026

Use this API to open other HTML5 applications (offline packages) from a different package within an mPaaS application.

Use the startApp API

AlipayJSBridge.call('startApp', {
  appId: '90000000',
  param: {
    url: '/index.html'
  }
}, function(result) {
  // noop
});

// Note: To open multiple app instances,
// place both appClearTop and startMultApp in the param object.
AlipayJSBridge.call('startApp', {
  appId: '90000000',
  param: {
    url: location.href,
    appClearTop: false,
    startMultApp: 'YES' // Note that the value is the string 'YES', not a boolean type.
  }
}, function(result) {
  // noop
});

Code examples

  • Open an application with a transparent title bar:

    <h1>Click the button to see the effect</h1>
    <a href="javascript:void(0)" class="btn dream">Open Wish Savings</a>
    <script>
    function ready(callback) {
    // If AlipayJSBridge is already injected, call the callback directly.
    if (window.AlipayJSBridge) {
      callback && callback();
    } else {
      // If not, listen for the injection event.
      document.addEventListener('AlipayJSBridgeReady', callback, false);
    }
    }
    ready(function(){
    document.querySelector('.dream').addEventListener('click', function() {
      AlipayJSBridge.call('startApp', {
        appId: '20000981',
        param: {
          url: '/www/dream-create.html',
          // Pass startup parameters.
          canPullDown: true,
          transparentTitle: 'auto'
        }
      }, function(result) {
        // noop
      });
    });
    });
    </script>
  • Open a new application and close the current one:

    <h1>Click the button to open a new application. The current application will be closed.</h1>
    <a href="javascript:void(0)" class="btn forest">Open Ant Forest</a>
    <script>
    function ready(callback) {
    // If AlipayJSBridge is already injected, call the callback directly.
    if (window.AlipayJSBridge) {
      callback && callback();
    } else {
      // If not, listen for the injection event.
      document.addEventListener('AlipayJSBridgeReady', callback, false);
    }
    }
    ready(function() {
    document.querySelector('.forest').addEventListener('click', function() {
      AlipayJSBridge.call('startApp', {
          appId: '60000002',
          // If you do not pass a URL, the app's default URL is used.
          param: {
            transparentTitle: 'auto'
          },
          closeCurrentApp: true
        }, function(result) {
          // noop
        });
    });
    });
    </script>
  • Open only one instance of an appId by default:

    <h1>Try to open the current page again. The current application will close and then reopen.</h1>
    <a href="javascript:void(0)" class="btn self">Open current page</a>
    <script>
    function ready(callback) {
    // If AlipayJSBridge is already injected, call the callback directly.
    if (window.AlipayJSBridge) {
      callback && callback();
    } else {
      // If not, listen for the injection event.
      document.addEventListener('AlipayJSBridgeReady', callback, false);
    }
    }
    ready(function(){
    document.querySelector('.self').addEventListener('click', function() {
      AlipayJSBridge.call('startApp', {
        // The current page is opened by the general application 20000067.
        // Therefore, when you call startApp here, other instances of 20000067 will be closed.
        // This means only one instance of the current page remains open.
        appId: '20000067',
        param: {
          url: location.href,
        }
      }, function(result) {
        // noop
      });
    });
    });
    </script>
  • Open multiple applications with the same appId:

    <h1>Open multiple applications with the same appId</h1>
    <a href="javascript:void(0)" class="btn multi">Open another application</a>
    <script>
    function ready(callback) {
    // If AlipayJSBridge is already injected, call the callback directly.
    if (window.AlipayJSBridge) {
      callback && callback();
    } else {
      // If not, listen for the injection event.
      document.addEventListener('AlipayJSBridgeReady', callback, false);
    }
    }
    ready(function() {
    document.querySelector('.multi').addEventListener('click', function() {
      AlipayJSBridge.call('startApp', {
        appId: '90000000',
        param: {
          url: '/index.html',
          appClearTop: false,
          startMultApp: 'YES' // Note that the value is the string 'YES', not a boolean type.
        }
      }, function(result) {
        // noop
      });
    });
    });
    </script>

API reference

AlipayJSBridge.call('startApp', {
  appId, param: {}, closeCurrentApp
}, fn)

Input parameters

Name

Type

Description

Required

Default

Baseline

appId

string

The ID of the offline package.

Yes

""

-

param

dictionary

The parameters to start the application. These are defined by the specific business application. For example, to specify a URL when opening an offline package, configure it in `param`. To run multiple instances, see Notes below.

N

The value supports string, bool, int, and double types.

-

closeCurrentApp

bool

Specifies whether to close the current app before starting the new one. This is useful when the page acts as a transitional page.

N

-

>10.1.60

fn

function

The callback function that is invoked if the call fails.

N

-

-

Error codes

Error code

Description

10

The specified appId is invalid.

11

Failed to start the application.

Notes

  • startApp is used to open an application. It operates at the application level and is different from pushWindow.

  • By default, if an application is already open, calling startApp again for the same application restarts it. This means you cannot run two instances with the same appId at the same time.

  • To run multiple instances of an application with the same appId, add the appClearTop=false&startMultApp=YES options to the `param` parameter.