If when using QWebView::setUrl() for the first time the URL contains an anchor(ex. #something) then the QWebView will fail to update. For example: int main(int argc, char *argv[]) { QApplication a(argc, argv); QWebView webView; webView.show(); webView.setUrl(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html"))); return a.exec(); } will successfully update the view to display the page, while: int main(int argc, char *argv[]) { QApplication a(argc, argv); QWebView webView; webView.show(); webView.setUrl(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html#itemDelegate"))); return a.exec(); } Will not update the webview at all. Calling QWebView::load(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html#itemDelegate"))); does work however, but the inconsistency of behavior when using anchors with QWebView::setUrl(...) is cause for concernt. Also not that the following also works: int main(int argc, char *argv[]) { QApplication a(argc, argv); QWebView webView; webView.show(); webView.setUrl(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html#itemDelegate"))); webView.setUrl(QUrl(QString::fromLatin1("http://doc.qt.nokia.com/4.7/qcombobox.html#itemDelegate"))); return a.exec(); } It is worth noting that in FrameLoader::loadWithDocumentLoader(DocumentLoader* loader, FrameLoadType type, PassRefPtr<FormState> prpFormState), WebCore/loader/FrameLoader.cpp:2077 if (shouldScrollToAnchor(isFormSubmission, policyChecker()->loadType(), newURL)) returns true for the first call to setUrl above and false for the second. Also, the Version of Webkit used is the one included with the Qt Master branch
Created attachment 84055 [details] Test case code
This bug is same as https://bugs.webkit.org/show_bug.cgi?id=32723 The root cause of the problem is same in both cases, the calls to d->frame->loader()->activeDocumentLoader()->writer()->begin(absolute); d->frame->loader()->activeDocumentLoader()->writer()->end(); in QWebFrame::setUrl is causing this problem. Im looking into another bug (https://bugs.webkit.org/show_bug.cgi?id=54380) that will possibly refactor this code.
*** This bug has been marked as a duplicate of bug 32723 ***