Integrating link capturing with window.open() flows

163 views
Skip to first unread message

Dibyajyoti Pal

unread,
Jan 29, 2024, 12:44:39 PM1/29/24
to content...@chromium.org, Dan Murphy
Hello content-owners@,

I'm Dibya from the dPWA team. I am currently working on a project to capture link navigations into an installed app (AKA link capturing), and had a question related to capturing links launched via `window.open` flows. The bug that I'm trying to fix has been referenced here.

In short, link capturing works by setting up a navigation throttle that captures link navigations, and passes it on to an installed PWA if there is one. As referenced in the bug above, this breaks the `window.opener` relationship, because we end up launching an installed app instead of reparenting the current web contents into the app. Reparenting here is hard, since the final url has not been committed yet, so the url for launch is not available. Waiting for the link to commit is not a good idea, since that would take time and is not a good user experience.

One possible solution that I thought of was to pass the window.opener object as part of the web contents during the "reparenting" logic, but I can't figure out what the launch url is of window.open(), as none of the public APIs seem to be returning that. Is there a way I can get the launch url of window.open() before the navigation completes, so that I can pass it over for reparenting?

Thanks!
Regards,
Dibya


Reply all
Reply to author
Forward
0 new messages