Hi, The problem is the semantics of anchor is: Go the given window (or open a new one), then navigate to the given URL. You are blocking the second stop, leaving a newly opened window on its initial blank page, you could probably also block the first stop by overloading QWebEnginePage::createWindow, but I don't think we have a way of seeing the URL at the time when a new window is opened.
On Tuesday, 29 January 2019 12:01:00 CET Sven Bergner wrote: > 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 > false. > > Best regards, > Sven > > > Am Mo., 28. Jan. 2019 um 23:25 Uhr schrieb Allan Sandfeld Jensen < > > k...@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 _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest