Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I prevent github hijacking my browser back button?

I'm using firefox.

  • I open a new tab
  • I go to: https://github.com/git/git
  • I click on the file COPYING
  • I click the browser back button

Now I am back at an empty tab, instead of the main code page.

It is very annoying.

How can I either entirely prevent github (and other sites) overriding my browser back button, or implement a workaround when they do?

like image 948
jhnc Avatar asked Oct 20 '25 00:10

jhnc


1 Answers

After much experimenting, I found this non-default config setting:

browser.navigation.requireUserInteraction = true

which led me to this relevant bug report:

  • Navigations from the location bar disappear from the session navigation history with browser.navigation.requireUserInteraction=true

I have no recollection of setting that option but resetting it to default (false) immediately made the location history reappear when right-clicking the back button.


It's slightly odd that only github was affected (but I can see they use javascript that mentions things like "poping a state from the history stack" and "prevent our state from getting out of sync with the browser's history stack", so ...).

Thanks to @0stone0 for pointing me in the right direction.

like image 179
jhnc Avatar answered Oct 22 '25 15:10

jhnc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!