Auto Refresh Page isn’t just about refreshing web pages — it’s a powerful tool that allows you to execute custom JavaScript code after each page refresh or at each countdown interval. This feature opens up a world of possibilities, letting you automate tasks, modify page content, or trigger specific actions. In this guide, we’ll show you how to run custom JavaScript code with Auto Refresh Page and explore some practical examples.

How to Run Custom JavaScript After a Refresh

Follow these steps to execute your own JavaScript after a page refresh:

  1. Install Auto Refresh Page
    Make sure you have Auto Refresh Page installed in your browser (Opera, Yandex.Browser).
  2. Access Advanced Options
    Open Auto Refresh Page and click on the Advanced options.
  3. Enable “Refresh and Run Code”
    Checkmark the Refresh and run code option.
  4. Enter Your JavaScript Code
    In the textbox area, enter your JavaScript code. Here’s an example: document.querySelector('body'); setTimeout(() => { alert('Hello!') }, 1000);
  5. Enable “All Frames” (Optional)
    If you want to run the code on all internal documents, check the All frames option.
  6. Start the Refresh
    Click the Start button to begin the countdown and trigger the refresh along with the script execution.

Example Scripts

Here are some examples of what you can do with custom JavaScript code in Auto Refresh Page.

Hello World Alert

This script will display an alert with “Hello!” after each refresh:

setTimeout(() => { alert('Hello!') }, 1000);

Changing the Page Background Color

This script changes the page’s background color to a random color after each refresh:

function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}

document.querySelector('body').style.background = getRandomColor();

What You Can Do with Custom JavaScript

The possibilities with custom JavaScript are vast! Here are some ideas on how you can use this feature:

  • Automate interactions: Automatically click buttons or other elements on a page.
  • Perform searches: Automatically search for specific information on a page.
  • Toggle functionality: Enable or disable specific features on the page.
  • Control page scrolling: Scroll the page from top to bottom (or vice versa).
  • Modify page styles: Change CSS styles to customize the appearance.
  • Auto-register and submit forms: Automatically fill out and submit forms without manual input.
  • Bypass bot protection: Bypass certain security measures like Google’s robot verification.
  • Parse page data: Extract and process data from the page content.

Conclusion

With the ability to execute custom JavaScript on each refresh, Auto Refresh Page becomes an incredibly versatile tool. Whether you want to automate tasks, manipulate content, or create complex interactions on the page, the only limit is your imagination!