JavaScript Window Scripts

A massive collection of vanilla JavaScript tools to manipulate browser windows and dialogs. Create popups, handle alerts, shake the screen, or manage exit-intent behaviors.

One-Time Popup

Opens a popup window only once per browser session. Useful for announcements that shouldn't annoy the user on every page load.

Remote Window Control

Allows the main window (the opener) to control a child popup window, such as closing it, moving it, or changing its URL.

Page Load Popup

Automatically launches a popup window the moment the page finishes loading.

Page Exit Popup

Triggers a popup window when the user attempts to leave the page or close the browser tab (Unload event).

Auto-Close Window

A script that automatically closes the current browser window after a set number of seconds. Great for temporary splash pages.

Moving Window Effect

A playful script that causes the browser window to physically move around the user's screen (desktop only).

Popup Image Viewer

Opens an image in a perfectly sized popup window without the browser toolbars or status bars.

Customized Popup Window

A utility to generate popup windows with specific properties: define size, scrollbars, resizing options, and toolbar visibility.

Screen Resolution Alert

Detects the user's screen resolution and alerts them if it is too low to view your site correctly.

Window Opener Utility

A versatile function for opening windows with minimal code. Reuse this script to open multiple links in specific window configurations.

Browser Window Shake

Simulates an earthquake by rapidly moving the browser window back and forth. An attention-grabbing effect.

Pop-under Window Creator

Opens a new window behind the current browser window, so the user only sees it after they close the main page.

Custom Alert Trigger

Trigger a JavaScript alert box based on specific user actions or logic events.

Centered Popup Window

Automatically calculates screen size and opens the popup window exactly in the center of the monitor.

Thank You Alert

Displays a polite "Thank You" message in an alert box when a user leaves your website.

Warning Alert Box

A pre-styled alert script designed to deliver warnings or critical information to the user.

Internal Popup Blocker

A script designed to prevent your own site from launching too many popups if a user clicks rapidly.

Hidden Alert Message

Embeds an alert message that is only triggered under specific, "secret" conditions (like a specific key press).

Button Click Alert

Attaches a custom alert message to a standard HTML button.

Simple Popup Blocker

A rudimentary script to check if a popup was successfully opened, and alert the user if their browser blocked it.

Runaway Button Effect

A prank script where a button moves away from the mouse cursor whenever the user tries to click it.

Browser Window Shaker

Another variation of the screen shake effect, useful for grabbing attention during validation errors.

Custom Alert Box

A standard implementation of the window.alert() method.

User Prompt Dialog

Uses window.prompt() to ask the user for input and then uses that input on the page.

Exit Intent Popup

Detects when the mouse leaves the browser viewport (heading towards the tab bar) and fires a popup.