Scroll Control - Firefox Add On


I had a bit of downtime while waiting for a flight and decided to try coding a browser extension to limit time spent on websites that implement infinite scroll. As my talent lay more on the ‘back end’, I leveraged the Kagi AI Code assistant to help get something put together quickly. The result:

Scroll Control - A browser add on for Firefox and Firefox Mobile to stop infinite scroll based on user-defined settings


References

Developing with AI

The last time I tried coding with an AI assistant, things did not go well. Since then I’ve largely been using AI tools for troubleshooting and other purposes. Today I decided to try and make something useful, and it seems to me that the quality of AI coding tools has increased substantially in 2025. End to end, it took about 45 minutes to get something usable developed.

Here was my initial prompt:

Create a plugin for Firefox which will:
- Take a list of websites as input
- Take a configurable 'scroll' value as input
- For the websites specified, only allow the ability to scroll 'down' the page the number of times specified in the configurable 'scroll' value

Purpose: Prevent time wasting on websites which implement infinite scrolling (facebook, reddit, etc...) by allowing users the ability to scroll down a certain number of times, then scroll up and down through the page, preventing the ability to scroll down further

After about a minute it created a skeleton of the extension with basic functionality in place. It required a couple more rounds of refinement, which I supplied with these prompts in the same session:

This code block doesn't work. 'result' is undefined, what can be done to fix this issue?:

// Load settings from storage
  function loadSettings() {
    chrome.storage.sync.get(['websites', 'scrollLimit'], function(result) {
      websiteList = result.websites || [];
      maxScrolls = parseInt(result.scrollLimit) || 5;

      if (shouldLimitSite()) {
        isLimited = true;
        initScrollLimiter();
      }
    });
  }
These changes successfully prevent scrolling beyond the defined limit and allow me to scroll back 'up'. However, I am unable to scroll back 'down' to the limit. Update the code to allow me to scroll up and down to the same scroll point.
Fix the preferences page so it loads correctly
How can I make it work on mobile firefox?

I also fed in the firefox add-on audit report which was generated while adding it to the addons.mozilla.org site (approval still pending).

The AI solved a few problems with iteration:

  • Converted the code from Chrome to Firefox (initially it created a chrome extension)
  • Fix a scrolling issue which prevented users from scrolling up and down in the defined range
  • Fix a potential security issue related to a naive use of innerHTML
  • Update the code to work on Firefox Mobile as well as desktop

At this point I have an extension that I actually want to use and solves the potential problem of idle scrolling on sites which have infinite scroll.

Operation

This is what it looks like:

scroll-control

scroll-control2