Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-20473

Not able to set User-Agent in XMLHTTPRequest using javascript.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 4.7.4
    • None
    • MeeGo/Harmattan on arm hardware.

    Description

      Javascript function called from QML is:

      function sendRequest(request) {
      var xhr2 = new XMLHttpRequest;
      xhr2.open("GET", request);

      if(xhr2.readyState == XMLHttpRequest.OPENED)

      { xhr2.setRequestHeader('User-Agent','MyClient'); }

      xhr2.send();
      }

      Sniffing network traffic shows User-Agent stays at "Mozilla/5.0 (Nokia; Qt; MeeGo)\r\n".

      Implementing a custom QNetworkAccessManager and setting the header there solves the problem, but it should be doable also like described above.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            charles Charles Yin (closed Nokia identity) (Inactive)
            tarrasq Tapani Mattila
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes