0

Similar to Change the URL using GreaseMonkey

I have an internal URL that shows a form which I have to press a button to trigger a POST on the same URL with extra data. What happens is the landing URL and the result of the POST gives two different history entries.

I have my GreaseMonkey script already clicking the button, but what I want is if I press back it goes two history entries back, rather than the GET page which then triggers my GreaseMonkey script again.

starball
  • 20,030
  • 7
  • 43
  • 238
Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
  • Hm looking at [the current History API](https://developer.mozilla.org/en-US/docs/Web/API/History), I'm not sure if this is possible. The browser's back&forth history buttons aren't something you can tamper with either. You could probably easily write a userscript to add a button that goes back two history entries. You could maybe overwrite the form's submit button to instead send the form via the Fetch API and then use `window.history.replaceState` to do some monkey business there, but I'm not sure. – starball Jan 28 '23 at 04:55
  • yes the answer being no. – Archimedes Trajano Jan 28 '23 at 13:35

0 Answers0