Skip to content

Prevent modal dialogs in "non-active windows" #1548

@domenic

Description

@domenic

(This is splitting from #1473 (comment))

In very rare situations, it is possible to apply the modal dialog functions (alert/confirm/prompt/print) to windows which no longer correspond to an active document. An example is shown in https://allow-modals-navigation-wbeliirtbv.now.sh/, which reveals that Firefox and Edge disallow this, whereas Chrome and Safari (TP) allow it.

It seems reasonable to disallow this in general. @mikewest was roughly in favor when asked, from the Chrome side. @rniwa, @cdumez, any comments from WebKit?

I think the test would be something like

If this Window's Document object is not fully active, throw a "SecurityError" DOMException.

Note that this matches similar provisions for various window.history.* properties which already have such a check.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions