Skip to content

Feature request: Access to "user gesture" flag, especially in 'new-window' event #9973

Closed as not planned

Description

@pfrazee

Knowing whether the user initiated the new-window event is important for blocking unwanted popups in a webview. Without it, an untrusted page can call window.open() or anchorTag.click() to trigger popups at will.

In webContents.executeJavascript, we have a userGesture parameter which overrides the flag indicating whether the user triggered an event.

Is it possible for the application to get access to the state of that flag via a function call - something like webContents.hasUserGesture()? If not, could we get access to it in the new-window event via an attribute, event.hasUserGesture ?

(I can make a PR if somebody can assure me this is doable, and point to relevant APIs.)

Activity

  1. themihai commented on Nov 27, 2018

    @themihai

    I need to set disable userGesture constrain so a PR would be great.
    #15856

  2. sentialx commented on Jul 29, 2019

    @sentialx
    Contributor

    +1 I just wanted to open a new issue, but I saw this. Is there any progress on it?

  3. MarshallOfSound commented on Aug 25, 2026

    @MarshallOfSound
    Member

    The new-window event was removed a while ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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