← Back to release summary

New window.open() popup vs. window behavior

Category
DOM
Type
Chromium catches up
Status
Enabled by default (Chrome 98)
Intent stage
Shipped

WPT details: https://wpt.fyi/results/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name?label=master&label=experimental&aligned&q=open-features-is-popup-condition.html

Summary

This change aligns Chromium with the spec for window.open(), by 1) adding a "popup" windowFeature to control popup vs. tab/window, and 2) ensuring all BarProp properties return !is_popup.

Motivation

The window.open() API is currently confusing to use, in terms of trying to get it to open a popup vs. a tab/window. This change simplifies the usage by adding a single boolean argument called 'popup' that works as you'd expect: popup=1 gets you a popup, and popup=0 gets a tab/window: const popup = window.open('_blank','','popup=1'); const tab = window.open('_blank','','popup=0'); Also there were previously confusingly-behaved getters for the BarProp visible properties (e.g. window.statusbar.visible) which didn't correctly represent what was actually visible. Now, those all return true if you got a new window/tab, and false if you got a popup. This is an interop-driven change, to align Chromium with the newly-landed spec for window.open. It does not change existing behavior around whether a popup or tab/window is opened, to avoid compat issues.

Standards & signals

Ecosystem

Explainers: https://arai-a.github.io/window-open-features/proposal.html

View on chromestatus.com