All Products
Document Center

Resume a page

Last Updated: Mar 24, 2021

When a webview interface returns to the top of stack again, such as it is evoked from background, screen is unlocked, or it return from the next page, the event of page resume (resume) will be triggered.

If the interface is returned via popWindow or popTo and data parameter is delivered, the page can obtain data.

If the resume of App takes place before resume of the interface, the event will come with a resumeParams containing parameters received during app resume.


  • For the clients above 10.0.15 version, the container newly adds the pageResume and appResume events for the service to distinguish which case has triggered resume.
  • Page resume (resume)= Client being evoked from background, lock screen interface being restored (appResume) + window being restored after returning from the next page (pageResume).
  • Since whether Android native resume and pause event are caused by pushed background or page switch cannot be distinguished, the pageResume and pagePause event are called back through the JSAPI calling record, and therefore only applicable to mutual switch among windows in the same session. The method that startApp and other clients directly switch pages is invalid, such as chooseImage.

Use resume interface

  1. document.addEventListener('resume', function(e) {
  2. console.log("resumed");
  3. }, false);

Code sample

The following example is the case with data when returning:

  1. <h1>When click "Open new page" and then return, data will be brought to the page</h1>
  2. <a href="#" class="btn J_demo">Open a new page</a>
  3. <script>
  4. function ready(callback) {
  5. // Call directly if JSBridge has been injected
  6. if (window.AlipayJSBridge) {
  7. callback && callback();
  8. } else {
  9. // Monitor the injected events if JSBridge hasn't been injected
  10. document.addEventListener('AlipayJSBridgeReady', callback, false);
  11. }
  12. }
  13. ready(function() {
  14. document.querySelector('a').addEventListener('click', function() {
  15.'pushWindow', {
  16. url: location.pathname
  17. });
  18. });
  19. document.addEventListener('back', function(e) {
  20. e.preventDefault();
  21.'popWindow', {
  22. data: {
  23. from: location.href,
  24. info:
  25. }
  26. });
  27. });
  28. document.addEventListener('resume', function(event) {
  29. alert ('contents brought when page rolls back: ' + JSON.stringify(;
  30. });
  31. });
  32. </script>


Output parameters

The event parameter of event handling function has the following attributes:

Name Type Description
data object The contents brought by popTo or popWindow in the current App instance. Data cannot be passed across appId.
resumeParams object Contains parameters received during app resume.