WebView 3.0 - how to detect window.open and load the page
-
wrote on 15 Sept 2014, 09:08 last edited by
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 -
wrote on 1 Oct 2014, 17:33 last edited by
Try "reimplement" your "webPage" on CPP file?
Try create a custom "webPage"Add method "QWebPage::createWindow" and in your webView use: @setPage(new MyCustomWebPage)@
-
wrote on 1 Oct 2014, 18:43 last edited by
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" ?? -
wrote on 4 Oct 2014, 07:04 last edited by
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 ?? -
wrote on 4 Oct 2014, 17:42 last edited by
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.
-
wrote on 4 Oct 2014, 17:58 last edited by
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 ?? -
wrote on 4 Oct 2014, 18:10 last edited by
"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".