Unsolved QWebview does not load all pages?
-
Hello,
I tried loading http://nusmods.com/timetable/sem-1 but it doesn't work if i load into my QWebview.
Even if i used this,
ui->webView->load(QUrl("http://www.google.com"));and try to navigate to the webpage it also won't load?
Can someone explain the cause and solution to this?
-
@GCDX
both links you provided redirect to https, so i guess you are missing the OpenSSL libs.
But corresponding warnings should be printed to the console. -
The google link works, and so do many links, it just so happen this one doesn't and if i try to use QWebview to google from there it still wont work. So i dont think its openSSL libraries?
-
@GCDX
so you are using QtWebkit right? (since you said you use QWebView)Check if the are any errors during loading by inspecting the relevant signals of QWebView/QWebPage/QWebFrame.
Check javascript errors (subclass QWebPage and overload javaScriptConsoleMessage()) and assign your custom QWebPage sublass to your QWebView (via setPage()) -
@raven-worx I dont think there are errors at all during compiling! Could you elaborate on the how to check javascript errors or link me to documentation?
-
@GCDX
@raven-worx does not mean there will be any "compilation errors", he means check for run-time errors.For, say, a JavaScript error he has already given you the documentation link http://doc.qt.io/archives/qt-5.5/qwebpage.html#javaScriptConsoleMessage. So you just sub-class
QWebPage
and override that virtual function to (say)qDebug()
whatever its parameters are. For theQWebView
etc. you go to http://doc.qt.io/archives/qt-5.5/qwebview.html and look at the Signals section, e.g. you want a slot for http://doc.qt.io/archives/qt-5.5/qwebview.html#loadFinished so that you canqDebug() << ok
.