dodo icon indicating copy to clipboard operation
dodo copied to clipboard

Fix opening links with `target=_blank`

Open The-Compiler opened this issue 1 year ago • 0 comments

A <a href="..." target="_blank"> element can be used by websites to request a link to be opened in a new tab. For some reason, some links in mails seem to have target="_blank" set too.

When such a link is clicked, QtWebEngine emits a newWindowRequested signal instead of opening the link directly: https://doc.qt.io/qt-6/qwebenginepage.html#newWindowRequested

This commit extracts the link opening code from acceptNavigationRequest to a _handle_link helper method, and also calls that when said signal is emitted.

The-Compiler avatar Oct 07 '24 11:10 The-Compiler