Sankalp Mishra’s Post

Day 73 of me reading random and basic but important dev topicsss.... Today I read about the Lost Art of Popups & the Browser Gatekeeper ..... As frontend engineers, we’re obsessed with seamless SPAs, modals, and dynamic rendering. But sometimes, what we need is true isolation and that’s where the classic Popup Window comes in. While popups are an ancient artifact of the early web, they are still a critical tool for specific modern use cases like OAuth flows (Google/Facebook login) or detached secondary tools. Why? Because a popup runs in its own independent JavaScript environment, making it a safe sandbox for interacting with untrusted or third-party origins. The Golden Rule of Popups: The Blocker In the early 2000s, popups were abused relentlessly by ad networks. To counter this, browsers introduced aggressive popup blockers. Today, the rule is simple: Browsers will block any popup that is NOT triggered by a direct user action. Blocked: // Runs on load or inside an async callback window.open('https://example.com'); Allowed: // Synchronously bound to user intent button.onclick = () => {   window.open('https://example.com'); }; The window.open Arsenal The syntax is window.open(url, name, params). * url: The destination. * name: The target name. (Pro-tip: If you use the same name multiple times, it will refresh the existing popup rather than spawning endless new windows!) * params: A comma-separated string of configurations (no spaces!). Keep Learning!!!!! #JavaScript #WebDevelopment #FrontendDev #SoftwareDevelopment

  • diagram

To view or add a comment, sign in

Explore content categories