WebView 3.0 - how to detect window.open and load the page
-
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 -
Try "reimplement" your "webPage" on CPP file?
Try create a custom "webPage"Add method "QWebPage::createWindow" and in your webView use: @setPage(new MyCustomWebPage)@
-
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" ?? -
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 ?? -
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.
-
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 ?? -
"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".