0

Is it possible to write a bookmarklet that repeatedly jumps to the end of page in the background?

I want to scroll down "all the way" on Facebook. Currently I have to do it manually by sending End-of-page multiple times. I would like to do that automatically and in the background (i.e. I can continue browse in another window or tab while my Facebook tab scrolls down).

d-b
  • 695
  • 3
  • 14
  • 43

1 Answers1

1

this might help

you can use this code to scroll to the bottom of the page

window.scrollTo(0, document.body.scrollHeight);

if you wrap it in a setInterval, you can make it repeat this might work

javascript:setInterval(window.scrollTo, 1000, 0, document.body.scrollHeight)
  • That looked very promising, but when I make a bookmarklet of it (in Firefox) and click it, it replaces the content of the page with a number. can you fix that? If so, I will mark it at the accepted answer. It would also be great if it allowed me to set the number of repetitions (e.g., 10 - that is, "end of page" 10 times and wait 2 seconds after each "end of page" to allow for loading more content) in the bookmarklet. – d-b Nov 07 '22 at 22:23
  • I'm not sure what the issue is but if Firefox is loading a number there is a fix for it. you can fix the number problem by just adding something like Console.log(":)") to the end of it. if Firefox is causing the issue than I cant solve it, I don't have Firefox – CoastStarlight Nov 08 '22 at 14:05
  • What is the exact syntax for that? – d-b Nov 08 '22 at 14:33
  • 1
    `javascript:setInterval(window.scrollTo, 1000, 0, document.body.scrollHeight);Console.log(":)")` – CoastStarlight Nov 08 '22 at 20:46
  • That worked! And how do you make it repeat 10 times with 1 second delay between repetitions? – d-b Nov 08 '22 at 21:09
  • you can put it in a self calling funtion like so `javascript:scrollnum = 0;function scroll10() {window.scrollTo(0, document.body.scrollHeight);scrollnum++;if(scrollnum < 10) {setTimeout(scroll10, 1000)}};scroll10();Console.log(":)");` hopefully that should work – CoastStarlight Nov 08 '22 at 21:51