this.platform.registerBackButtonAction does not work


#1

Hello,

I have the problem, that it doesn’t enter the method registerBackButtonAction when click button back. I need for some pages a custom back function. I test it with a web browser Chrome.
Make I something wrong?

app.html

<ion-menu persistent="true" [content]="content">
    <ion-header>
      <ion-toolbar>
        <ion-title>Menü</ion-title>
      </ion-toolbar>
    </ion-header>

  <ion-content>
    <ion-list>
      <button menuClose ion-item *ngFor="let i of items" (click)="openView(i.view)">
        {{ i.title | translate }}
      </button>
    </ion-list>
  </ion-content>
</ion-menu>

<ion-nav id="nav" [root]="rootPage" #content></ion-nav>

app.component.ts

@Component({
  templateUrl: 'app.html'
})

export class MyApp{
  @ViewChild(Nav) nav: Nav;
  rootPage = HomePage;
  menuitems = .....;
  constructor(private platform: Platform, private statusBar: StatusBar, private splashScreen: SplashScreen,
              private translate: TranslateService) {
    this.platform.ready().then(() => {
      this.statusBar.styleDefault();
      this.splashScreen.hide();
      this.platform.registerBackButtonAction(function (event) {
       console.log('Entered')
      });
    });
 }

  openView(page) {
    this.nav.push(page);
  }
}

#2

backbutton can only work in device and not on browser