Topic on Project:Support desk

Problem with browser back button

5
Summary by Alexandre7411

Do not use window.location.replace() function to do redirection it can mess up the brower history.

Alexandre7411 (talkcontribs)

Hi,

I have a problem with the back button of the browser, the wiki doesn't seem to respect the history correctly and redirects the user in the wrong way.

I have created a video to illustrate this problem that you can watch on youtube at the following link: https://youtu.be/4qE6tJ5w_4A

My wiki to the next version : MediaWiki(1.35.1), PHP7.4.13 (fpm-fcgi)

I have tried it on Safari/Firefox/Chrome in private mode and without private mode. The problem still occur every time.


Thank you in advance for your help

Malyacko (talkcontribs)
Alexandre7411 (talkcontribs)

Since no response was received, I allowed myself to repost the question. I will close this topic as you don't want duplicate

Gib Senf dazu! (talkcontribs)

There are some gadgets and tricky things which may skip or insert one entry in history, especially when a page redirect is executed, but to the benefit of the user. It works fine over many years on millions of redirect pages with all browsers with no complaints of WMF wiki communities. IIRC it is about inserting a &redirect=no URL or to preserve a fragment identifier or something else meaningful.

Alexandre7411 (talkcontribs)

I found the solution to my issue. Some of my buttons were using the javascript window.location.replace() function which the created problem in the browser history. The issue was in my js code, I'm sorry for the inconvenience.