Gesturefy icon indicating copy to clipboard operation
Gesturefy copied to clipboard

Go to first page of history

Open Mike987654 opened this issue 8 years ago • 8 comments

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.

Mike987654 avatar Nov 16 '17 15:11 Mike987654

It could be possible via script injection using: window.history.go(-window.history.length + 1) I'll look into it.

Robbendebiene avatar Nov 18 '17 16:11 Robbendebiene

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

Robbendebiene avatar Dec 03 '17 16:12 Robbendebiene

Any updates on that issue/API enhancement? Would be really useful (:

despecial avatar May 04 '19 09:05 despecial

No, but as far as I know they are working on a new session API which may have the capability to solve this issue.

Robbendebiene avatar May 04 '19 17:05 Robbendebiene

how about this approach?

for (let i = window.history.length - 1; i > 0; i--) { window.history.back(); }

despecial avatar Jun 07 '19 22:06 despecial

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.

Robbendebiene avatar Jun 07 '19 22:06 Robbendebiene

got this code snippet from another extension. not tested. too bad history.go(window.history.length - 1) doesnt work even when user in between

despecial avatar Jun 08 '19 22:06 despecial

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. 😁

ygoe avatar Jan 31 '22 17:01 ygoe