All Products
Search
Document Center

Mobile Platform as a Service:Hide loading indicator

Last Updated:Jan 27, 2026

Use this API to hide the global loading indicator.

Use the hideLoading API

AlipayJSBridge.call('hideLoading');

Code example

Show or hide the global loading box:

<h1>Click the buttons below to see different effects</h1>
<p>Note: On Android, the loading indicator covers the entire screen. Use the system back button to close it.</p>
<button class="btn show">Show loading indicator</button>
<button class="btn delay">Show loading indicator after 2 seconds</button>
<button class="btn notext">Spinner without text</button>

<script>
function ready(callback) {
  // If jsbridge is already injected, call it directly.
  if (window.AlipayJSBridge) {
    callback && callback();
  } else {
    // If not, listen for the injection event.
    document.addEventListener('AlipayJSBridgeReady', callback, false);
  }
}
ready(function() {
  document.querySelector('.show').addEventListener('click', function() {
    AlipayJSBridge.call('showLoading', {
      text: 'Loading',
    });
    setTimeout(function() {
      AlipayJSBridge.call('hideLoading');
    }, 3000);
  });

  document.querySelector('.delay').addEventListener('click', function() {
    AlipayJSBridge.call('showLoading', {
      text: 'Loading',
      delay: 2000,
    });
    setTimeout(function() {
      AlipayJSBridge.call('hideLoading');
    }, 5000);
  });

  document.querySelector('.notext').addEventListener('click', function() {
    AlipayJSBridge.call('showLoading', {
      text: ' ',
    });
    setTimeout(function() {
      AlipayJSBridge.call('hideLoading');
    }, 3000);
  });
});
</script>