How to trigger change when using the back button with history.pushstate and popstate?

The popstate only contains a state when there is one. When it goes like this: initial page loaded new page loaded, with state added via pushState back button pressed then there is no state, because the initial page was loaded regularly, not with pushState. As a result, the onpopstate event is fired with a state … Read more

How to handle back button on Ionic 2

Here’s how I did it: In every Page component, I created a function called backButtonAction(), which will execute custom code for every page. Code: import { Component } from ‘@angular/core’; import { Platform, NavController, ModalController } from ‘ionic-angular’; import { DetailsModal } from ‘./details’; @Component({ selector: ‘page-appointments’, templateUrl: ‘appointments.html’ }) export class AppointmentsPage { modal: … Read more

Phonegap – navigator.app.backHistory() not working on HTML back button

I have tried 3 separate things when I faced the same situation: window.history.back() navigator.app.backHistory(); History.go(-1); Individually, none of these solve the problem. I put all 3 things together and much to my surprise it worked. I really don’t know what is behind it. Then I decreased to two functions and removed: window.history.back() Now I am … Read more

Flutter Back button with return data

The easier way is to wrap the body in WillPopScope, in this way it will work with the Back Button on the Top AND the Android Back Button on the Bottom. Here an example where both back buttons return false: final return = Navigator.of(context).push(MaterialPageRoute<bool>( builder: (BuildContext context) { return Scaffold( appBar: AppBar( title: Text(“New Page”), … Read more

Force JSF to refresh page / view / form when opened via link or back button

That page is likely being loaded from browser cache. This is essentially harmless, but indeed confusing to the enduser, because s/he incorrectly thinks that it’s really coming from the server. You can easily confirm this by looking at the HTTP traffic monitor in browser’s web developer toolset (press F12 in Chrome/FireFox23+/IE9+ and check “Network” section). … Read more

How to exit when back button is pressed?

In my Home Activity I override the “onBackPressed” to: @Override public void onBackPressed() { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } so if the user is in the home activity and press back, he goes to the home screen. I took the code from Going to home screen Programmatically