Question

to download a console returns the following error:

Frame load interrupted by policy change

Example:

<a href="app.exe">Start Download</a>

Console Preview: enter image description here

Should I configure something in the Compiler or QWebSettings?

Était-ce utile?

La solution

I discovered. In conventional Webkit browsers, the place to download the console shows how the request canceled, so before turning to "download manager" of the browser the request should be canceled.

solution:

//replace [QWebView] by your WebView
connect([QWebView]->page(), SIGNAL(unsupportedContent(QNetworkReply*)),
this, SLOT(downloadContent(QNetworkReply*)));

...

void [main class]::downloadContent(QNetworkReply *reply){
    //Replace "[main class]" by "Class" having the signs used in WebView.

    [QWebView]->stop();
    //solution: stop loading --replace [QWebView] by your WebView

    /*function to donwload*/
}

Autres conseils

Edit: hard to tell without a proper backtrace I requested in the comments, but it looks like the warning might actually be harmless.

Original: That's because the QWebView doesn't know what to do with your app.exe file -- it's not an HTML page or a text/plain document or a supported image, after all. The QWebView class is not a web browser; you apparently want to start a download of some file, but there's no full-blown download manager in that class. You will have to provide your own code for this -- the code will have to ask for a proper location to save it, etc.

You can start with QWebPage::setLinkDelegationPolicy and handle this particular click yourself.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top