Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. WebView 3.0 - how to detect window.open and load the page
Forum Updated to NodeBB v4.3 + New Features

WebView 3.0 - how to detect window.open and load the page

Scheduled Pinned Locked Moved Qt WebKit
8 Posts 2 Posters 3.9k Views 1 Watching
  • 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.
  • GianlucaG Offline
    GianlucaG Offline
    Gianluca
    wrote on last edited by
    #1

    Dear all,
    I have a WebView QML item that loads an html page where some <a> tags contains a javascript code for 'onclick' event and this javascript code performs some code and the open a new window with window.open code.
    With default settings, WebView completely ignore that, and nothing happens if you click on the link.
    What I want to do, instead, is to display that page when the user click on the link.
    How can I do ??

    Thanks,
    Gianluca

    1 Reply Last reply
    0
    • B Offline
      B Offline
      brcontainer
      wrote on last edited by
      #2

      Try "reimplement" your "webPage" on CPP file?
      Try create a custom "webPage"

      Add method "QWebPage::createWindow" and in your webView use: @setPage(new MyCustomWebPage)@

      QT project: https://github.com/brcontainer/qt-helper

      1 Reply Last reply
      0
      • GianlucaG Offline
        GianlucaG Offline
        Gianluca
        wrote on last edited by
        #3

        I don't understand your solution.
        I have the WebView QML item, so how can I set a custom QWebPage that it's not a QML Item ??
        And also, how can I re-implement QWebPage ?!?!
        I mean, after subclassing QWebPage how you suppose to detect the javascript code "window.open" ??

        1 Reply Last reply
        0
        • B Offline
          B Offline
          brcontainer
          wrote on last edited by
          #4

          Try use

          http://qt-project.org/doc/qt-4.8/qml-webview.html#newWindowComponent-prop
          http://qt-project.org/doc/qt-4.8/qml-webview.html#newWindowParent-prop

          QT project: https://github.com/brcontainer/qt-helper

          1 Reply Last reply
          0
          • GianlucaG Offline
            GianlucaG Offline
            Gianluca
            wrote on last edited by
            #5

            Thanks for the link to the documentation ... but it's Qt 4.8 and WebView 1.0 while I'm using Qt 5.3 and WebView 3.0 ... and I did not find the same properties on WebView 3.0 !! :-(
            They have been removed ?!?!
            WebView 1.0 had more functionality than WebView 3.0 ?!?! How this can be possible ??

            1 Reply Last reply
            0
            • B Offline
              B Offline
              brcontainer
              wrote on last edited by
              #6

              WebView 3.0? Or QtWebkit 3.0?
              Ok, I will see if it is possible to use "setPage" in "QML", if possible then just redeploy suffice.

              See you.

              QT project: https://github.com/brcontainer/qt-helper

              1 Reply Last reply
              0
              • GianlucaG Offline
                GianlucaG Offline
                Gianluca
                wrote on last edited by
                #7

                Sorry, I'm very confused.
                WebView is different from QtWebKit ?!?!
                I though that WebView was on of the Item provided by QtWebKit module or not ?!?!

                Also, I found that there is a big lacks in the documentation. I saw various examples using properties not documented but working perfectly.
                How can I get the list of all properties of WebView ??

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  brcontainer
                  wrote on last edited by
                  #8

                  "WebView" would be something like the "frame" already "QtWebKit" technology would be used by the "frame".

                  It's like you get a file "javascript", eg jQuery and create animation with jquery inside an "HTML" page. The "HTML + CSS" would be the frame and the "Jquery" technology would be used to give the animated effect.

                  What I mean is that the technology you are using is "QtWebKit3.0", but that does not mean he is not part of the "WebView".

                  When you have some time I will see if it is possible to catch the "WebView" and "connects it with the cpp file" in order to later use "setPage".

                  With "setPage" it is possible to detect the events of "window.open".

                  QT project: https://github.com/brcontainer/qt-helper

                  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