Selected work

15 / BROWSER EXTENSION

Popup Guard

Keep the page you chose, and close the windows it opens to somewhere else.

View source on GitHub ↗Discuss a similar project ↗

01 The context

What the work connects.

Some pages open a new tab or window to another site when you click anywhere, often an ad. Blocking every new window would also break the links and sign-in windows people actually want, so the useful distinction is where a window goes and whether you asked for it.

Built for
People who browse sites that open unwanted windows
My contribution
I built a Manifest V3 extension for Chrome and Edge with a toolbar panel for per-site rules, a settings page, and automated unit and browser tests.

02 How it works

From one step to the next.

  1. 01

    Open

    A page asks the browser for a new window

  2. 02

    Compare

    Check the destination site against the page's site

  3. 03

    Decide

    Apply the site's rule and your own clicks

  4. 04

    Close

    Close the window and count it on the badge

The extension watches the browser's own record of new tabs created by a page, including windows opened from embedded ad frames, and compares the destination with the opener's registrable domain from the Public Suffix List. Windows to the same site stay open. A small isolated script only reports genuine clicks on visible links, so a link you open yourself is not mistaken for a popup, while full-screen invisible link overlays are. Blank windows are judged by their first destination, and same-site windows that redirect elsewhere are closed.

03 The result

A working path through the task.

Each site can stay on the default, allow popups for sign-in or payment windows, or block every popup. A badge counts blocked windows, and a blocked one can be reopened once. Rules and a short origin-only log stay in the browser, and the code is public on GitHub. A blocked window exists for a moment before it closes, and in-page overlays are outside its scope.

04 Capabilities & tools

What it does.

  • Closes new tabs and windows that a page opens to another site, including popups from ad frames
  • Keeps same-site windows and the links you click yourself
  • Per-site rules: allow popups, block all popups, or keep the default
  • Blocked-popup count, a short local log, and a one-click reopen
  • JavaScript
  • Chrome Extension
  • Manifest V3