Go to first page of history
Thanks for making this add-on! It is a great replacement for firegestures, however this is one gesture I really miss.
Here is the script that I added to firegestures to get this added back then: if (gBrowser.sessionHistory.index > 0) gBrowser.gotoIndex(0);
This doesn't seem to work now.
It could be possible via script injection using: window.history.go(-window.history.length + 1)
I'll look into it.
Turns out, that this is currently not possible. The following code enables me to go to the last page from the first page and vice versa.
window.history.go(1 - window.history.length);
window.history.go(window.history.length - 1)
But this won't work if the user is somewhere between the first and the last history entry.
So this will require a new API by Mozilla, which is tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1378651
Any updates on that issue/API enhancement? Would be really useful (:
No, but as far as I know they are working on a new session API which may have the capability to solve this issue.
how about this approach?
for (let i = window.history.length - 1; i > 0; i--) { window.history.back(); }
I don't know how this should work. Even if you inject the code one by one in every single history page it's very hard to detect when the last page has been reached. Furthermore every history page has to be loaded again which can be very slow.
got this code snippet from another extension. not tested. too bad history.go(window.history.length - 1) doesnt work even when user in between
I have another idea that goes in the same direction, but I guess it's also impossible for modern computers to execute, so I didn't want to open another issue for it.
Sometimes, websites think they're smart and redirect visitors to another page. But then they do it in a way that's actually quite stupid, and even trigger the redirection when navigating back. (Browsers can understand this pattern but only if done right by the website.) So when quickly using the mouse gesture to navigate back, a reverse-stop could be employed that detects an immediate redirection and retries to go back for one step further; increasing the steps until no such undesired forwarding happens anymore.
Using the back toolbutton this can be accomplished by right-clicking the button and selecting a further item from the menu. But gestures don't have such a menu because they're so much quicker than even pointing at toolbuttons. And I want some comfort, please. 😁