[Interest] QWebEnginePage acceptNavigationRequest leads to empty page

Sven Bergner sven.bergner at gmail.com
Tue Jan 29 12:01:00 CET 2019

Hi Allan,
thanks for your suggestion. I think I've found the root of the behavior.
The link has a target="_blank" and that calls createWindow() which leads to
an empty window.
If I remove the target="_blank" I can intercept the link.
But for me that feels also like an error. What sense does it make to create
a new window when I don't need it because acceptNavigationRequest() returns

Best regards,

Am Mo., 28. Jan. 2019 um 23:25 Uhr schrieb Allan Sandfeld Jensen <
kde at carewolf.com>:

> On Montag, 28. Januar 2019 13:11:45 CET Sven Bergner wrote:
> > Hi there,
> > I have an app that uses QWebEngine to show a webpage that has a link to a
> > pdf document.
> > Now I want to handle a click on that link by
> > implementing QWebEnginePage::acceptNavigationRequest().
> > The method is called an I can check if the link leads to a pdf and if so
> I
> > handle the url by myself and return false. The downside is that the
> > QWebEngineView now shows an empty page.
> > Is there any way to prevent this? I want to stay on the same page where
> the
> > link was clicked.
> > Any hints?
> >
> Try disabling error-pages, with error-pages disabled, errors should result
> in
> staying on the same page, where with them enabled, navigations always go
> somewhere.
> Still sounds like an error, navigation should either not be performed or
> go an
> error-page.
> 'Allan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190129/7e409c8f/attachment.html>

More information about the Interest mailing list