govuk-browser-extension icon indicating copy to clipboard operation
govuk-browser-extension copied to clipboard

Extension doesn't preserve browser history

Open ChrisBAshton opened this issue 4 years ago • 2 comments

When using the extension links such as Production, Staging and Integration, the URL changes as expected. However, pressing the Back button does not take you back to the previous page.

We should look into using the History API to push the change to the history array, to fix the back button behaviour.

ChrisBAshton avatar Dec 06 '21 13:12 ChrisBAshton

I see this was reported a while ago but it's still the case and it's still very annoying when trying to debug something.

patrickpatrickpatrick avatar Sep 18 '23 12:09 patrickpatrickpatrick

Investigating this with the following journey:

  • Navigate to GOV.UK homepage
  • Click on Benefits
  • Open the extension, click on Content Item
  • Press the back button

On Chrome, the page that you end up on is the GOV.UK homepage and not Benefits (which is what would be expected). In Firefox this issue does not occur, it will go back to Benefits. When running this with Developer Mode turned on in Chrome extensions, I see the following console output:

Navigation to https://www.gov.uk/ was restored from back/forward cache (see https://web.dev/bfcache/)

The history (when right clicking the background) appears to be correct. Benefits appears in the dropdown and can be navigated to. When pressing back however, we get on the homepage.

patrickpatrickpatrick avatar Sep 21 '23 15:09 patrickpatrickpatrick