Skip to content

js: Fix language redirect breaking back button

Redirecting the user on page loading by assigning to location.pathname causes the page that redirected the user to be added to the browser session history. This means that if the user presses the back button after being redirected, they will immediately be redirected again.

This can be reproduced by visiting https://circle.gnome.org/ with a non-English language set as the preferred language, clicking on any of the apps, and then trying to return to the previous page.

Fix that by using location.replace() instead, which doesn't add an entry to the browser session history.

Merge request reports