Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to process target=_blank links in QtWebEngine?
Forum Updated to NodeBB v4.3 + New Features

How to process target=_blank links in QtWebEngine?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 3.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daniil Kolesnichenko
    wrote on last edited by
    #1

    I overloaded QWebEnginePage::acceptNavigationRequest method, but seems that it is not called when link's target is "_blank" (i.e. when link is supposed to be opened in new window). How can I handle such links and open them in new app instances?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      Look at the createWindow method:

      [virtual protected] QWebEngineView *QWebEngineView::createWindow(QWebEnginePage::WebWindowType type)
      This function is called from the createWindow() method of the associated QWebEnginePage 
      each time the page wants to create a new window of the given type.
      For example, when a JavaScript request to open a document in a new window is issued.
      Note: If the createWindow() method of the associated page is reimplemented, 
      this method is not called, unless explicitly done so in the reimplementation.
      See also QWebEnginePage::createWindow().
      

      Note that there is a dedicated WebEngine forum HERE

      1 Reply Last reply
      1
      • D Offline
        D Offline
        Daniil Kolesnichenko
        wrote on last edited by Daniil Kolesnichenko
        #3

        @mpergand Thank you very much! It is exactly what I need.

        UPD: there's no "mark as a correct answer" button under your post... how can I mark question as solved?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved