Callback On Link Back Using pushState When Click Browser Back Button [V2]


#1

Hello @nolimits4web,

I want to get callback or alert when I click browser back button when using pushState:true.

How I can achieve that ?


#2
Dom7(window).on('popstate',function(e){
  console.log('popstate')
});
Dom7(window).on('hashchange',function(e){
  console.log('hashchange')
});

#3

Hi @plpl,

how to achieve above method on one page only, not all page?


#4
//use one of them
{
  path: '/accordion/',
  url: './pages/accordion.html',
  on: { 
    pageBeforeOut:function(e,page){   
      console.log('Before Out')     
    },
    pageAfterOut:function(e,page){     
      console.log('After Out')        
    },
    pageBeforeRemove:function(e,page){  
      console.log('Before Remove')           
    }
  } 
}

#5

Hi @plpl,

I’m following your method, but still affecting all pages.

Hi @nolimits4web,

Any suggestion?