Skip to content

Navigation and new window handlers are triggered by iframe differently on each platform #1593

@jf908

Description

@jf908

Describe the bug

  • On Windows, navigating inside an iframe doesn't activate the navigation handler or the new window request handler.
  • On macOS, navigating inside an iframe activates the new window request handler.
  • On Linux (Ubuntu), navigating inside an iframe activates the navigation handler.

Steps To Reproduce

Run https://github.com/jf908/wry-iframe-test
and see the different console output when run on Windows, macOS and Ubuntu.

Expected behavior

Each OS should have the same behaviour and ideally it should be detectable whether the navigation is occuring inside the iframe or not.

Platform and Versions (please complete the following information):
OS: Windows 11 23H2, macOS 15.5, Ubuntu 24.04
Rustc: 1.88.0

Additional context

On Windows I'm using the navigation handler and the new window request handler to intercept and externally open URLs outside of my wry app where I need to but I cannot do the same on macOS/Linux because ad scripts often inject a navigating iframe which fires off these events so you cannot tell the difference between the user intentionally navigating and a random iframe that is changing URL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions