Back Button Pure Javascript


#1

Hi. I’m not using typescript + angular. I use javascript. I need simple action bar with back button. I get reference this page. Xml is here:

<Page loaded="loaded">
  <Page.actionBar>
    <ActionBar title="App Icon Demo">
      <NavigationButton text="Go Back" android.systemIcon="ic_menu_back" tap="onNavBtnTap"/>
    </ActionBar>
  </Page.actionBar>

Back button (arrow) not working. I write this code every page:

function onNavBtnTap() {
    frameModule.topmost().goBack();
}

exports.onNavBtnTap = onNavBtnTap;

I need to write every page ?


#2

For Android: yes, I think. You have to explicitly show the button, because the OS expects the user to use the hardware button to go back.

On iOS: the OS usually will add the button automatically.