Important: Please read the Qt Code of Conduct -

QueryStrings getting removed by QWebView

  • I have a Qurl that I am using to set the url of a webview. However the query string values are getting stripped by the webview.

    QUrl( "" )

    When I inspect the qwebview the "?touch=false" is missing from the url.

    Any thoughts ?



  • No, they aren't getting stripped :) I've tested it with PyQt 5.2 and I don't see if query string values disappeared.

    Can you show your code?
    Are you sure, that url with query string doesn't redirect on url without it?

  • Firstly, thanks for the response but they are getting stripped :-), But I am using Qt 5.1.1, could it be there is a difference ?

    I have written it several ways, and here is the last.
    QUrl publicationURL;
    QUrlQuery query;
    query.addQueryItem("touch", "false");

    qDebug() << QUrl(publicationURL.toEncoded());

    the QDebug statement has the correct url and query string values. in this case touch=false.

    Also I run the webserver and there is no redirects and nothing to strip the QS values there.

    One thing I did notice that was strange was in the QT Editor when I set the URL for the QWebView in design time the QWebView widget passes the QS correctly. But when I run the code as a (without setting the URL) the page loads but the QS values are missing. So design time works but not run time.

    Any help is appreciated.


Log in to reply