question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ion-back-button does not clean window.history

See original GitHub issue

Bug Report

Ionic version:

[x] 4.4.0 Beryllium

Current behavior:

When going back with the ion-back-button, the page is not being removed from the window.history. Example:

// First page (without back button)
window.history
History {length: 1, scrollRestoration: "auto", state: {…}}

// After navigating to page with back button
window.history
History {length: 2, scrollRestoration: "auto", state: {…}}

// After clicking on back button
window.history
History {length: 3, scrollRestoration: "auto", state: {…}}

Expected behavior:

After clicking the ion-back-button, we should remove that page from window.history. This should behave exactly the same as this.ionNavCtrl.back(), which seems to work as expected. Also, if it is not possible to go back and the ion-back-button uses the defaultBackLink property, then it should replace the current page with the one specified by the defaultBackLink property so we don’t keep that in window.history.

Ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.11.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.4.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 7.0.1
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

   Android SDK Tools : 26.1.1 (/Users/mau/Library/Android/sdk)
   ios-deploy        : 1.9.2
   ios-sim           : 6.1.2
   NodeJS            : v8.11.3 (/usr/local/bin/node)
   npm               : 6.9.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
KevinKelchencommented, Mar 11, 2019

Related to #15428 and #15181.

2reactions
maumchavescommented, May 18, 2019

I’ve updated my Ionic version from 4.1.1 to 4.4.0 and the problem remains. The description of this issue has been updated accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ion-back-button does not clean window.history #17752 - GitHub
Current behavior: When going back with the ion-back-button , the page is not being removed from the window.history . Example:.
Read more >
Ionic Back Button Doesn't Hide after exhausting $window ...
Ionic does pretty good about hiding the back button when it shouldn't be there but in this case not so. Any ideas for...
Read more >
Why doesn't IonBackButton use window.history? - Ionic Forum
BackButton implementation does not use window.history at all. Instead it first checks if ion-nav is used for navigation (ostensibly for ...
Read more >
Closing a modal with the back button in Ionic 5 / Angular 9
The solution : · 1. Dismiss the Pop-up when the back button is pressed · 2. Don't go back to the previous page...
Read more >
Ionic: How to Simulate Android back button in Browser
When we are developing and testing our Ionic apps is common that we ... The ionBackButton event will not be emitted when running...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found