refresh a ons-page after popPage()

  • Hello,

    Is it possible to refresh the ons-page after calling popPage()?

    Use Case:

    I have page A, Page B and Page C.

    On click of button in Page A, I pushPage B.
    On click of button in Page B, I pushPage C.

    Page C has a entry form with a ons-button. On click of the button, I post to rest api to save the data into the DB and then call popPage() which puts me in Page B fine.

    Now I need to refresh Page B. Is it possible please? I use JQuery.

    Thanks for your help in advance.

  • You can use postpop event

    document.addEventListener('postpop', function(event) {
    var page =;
      if ( === 'page1') {
           // code
      else if ( === 'page2') {
       // code

  • @jamal said:

    var page =;

    Thanks Jamel.

    I got that part. Then problem is refreshing the page B at postpop,

    I tried removePage() and insertPage(). Nothing seems to work.

    Any suggestion please.

    Once again thanks!

  • Jamel,

    My app has navigator with stack of pages. returns the navigator id not the current page that is getting popped.

    The above does not work.


  • May be instead of we can use event.enterpage.

    But the question remains how to refresh the enterpage?


  • @mmike,

    BTW, it is Jamal.

    I think you ‘refresh’ a page by calling code that updates the page either thru CSS or the values of elements.

    Maybe you need to write a refresh function that updates your pages accordingly.

    As to getting correct page that popped, here is a jquery sample:

     $(document).on('postpop', '#navigator', function(event) {
            if (page.matches('#page3')) {
              // refresh code 


  • Awesome! That works great.
    Thanks for your help, Jamal!

  • Hi Jamal,

    Safari does not recognize “init” event. The above works just in chrome / firefox.

    Any thoughts?


Log in to reply