Important: Please read the Qt Code of Conduct -

How to abort loading a URL in QTWebkit

  • Dears,

       How to abort loading a URL when timeout?  For example, if a start load a URL with :

    const char *szUrl = "";
    QUrl qUrl = QUrl(szUrl);

    If there is no response and timeout ,how can I abort this request?

    Thanks and Regards,

  • Moderators

    AFAIK thats not least with the QWebView API.

    You need a QNetworkReply instance to abort a network transfer. But the API doesn't expose it anywhere.
    Thus you you would need to subclass QNetworkAccessManager and reimplement QNAM::createRequest() and do it there. Then set your custom QNAM to the QWebPage.

  • @enum QWebPage::WebAction
    //QWebPage::Stop 10 Stop loading the current page.

    void QWebView::stop () [slot]
    //Convenience slot that stops loading the document.
    //It is equivalent to

Log in to reply