• Welcome to Web Hosting Community Forum for Webmasters - Web hosting Forum.
 

Recommended Providers


Jetpack
Fully Managed WordPress Hosting
lc_banner_leadgen_3
Fully Managed WordPress Hosting

WordPress Theme

WordPress Hosting Divi WordPress Theme
WPZOOM

Forum Membership

Forum Membership

Auto scroll up/down page at regular interval in Google Chrome without extension

Started by Kailash, June 14, 2024, 01:44:03 PM


WordPress Hosting


Kailash

Sometime, we may need to scroll up/down a web page in Google Chrome for automation. You can do this without any third party Chrome extension. This is possible using the simple JavaScript code as follow:

To auto scroll UP a web page at regular interval:

  • Open Google Chrome and navigate to the web page you want to auto-scroll.
  • Open the Developer Tools by pressing Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (Mac).
  • Go to the Console tab.
  • Copy and paste the following JavaScript code into the console and press Enter:

setInterval(() => {
    window.scrollBy(0, window.innerHeight);
}, 60000);  // 60000 milliseconds = 1 minute

This script uses setInterval to execute the window.scrollBy function every 60 seconds (60000 milliseconds), scrolling the page by the height of the visible window each time. If you want to scroll by a different amount, you can adjust the second argument of window.scrollBy(0, window.innerHeight) to a specific number of pixels.

To auto scroll DOWN a web page at regular interval:

  • Open Google Chrome and navigate to the web page you want to auto-scroll.
  • Open the Developer Tools by pressing Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (Mac).
  • Go to the Console tab.
  • Copy and paste the following JavaScript code into the console and press Enter:

setInterval(() => {
    window.scrollBy(0, -window.innerHeight);
}, 60000);  // 60000 milliseconds = 1 minute

window.scrollBy(0, -window.innerHeight): This scrolls the page up by the height of the visible window (window.innerHeight). The negative value (-window.innerHeight) ensures that the page scrolls up.

Regards,
Kailash