Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-14652

CordovaSim: cross-origin requests send default user agent string in headers

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 4.1.0.Beta2
    • 4.1.0.Beta1
    • None
    • None

      Cross-origin XMLHttpRequest send browser's default User Agent string in the request headers.

      Steps to reproduce:
      Create the following page in a hybrid project and open it with CordovaSim:

      ua-test.html
      <script>
      	var client = new XMLHttpRequest();
      	client.onreadystatechange = function() {
      		if(client.readyState == client.DONE) {
      			if (client.status == 200) {
      				alert(/<span id="body_lbUserAgent">([^>]*)<\/span>/ig.exec(client.responseText)[1]);
      			} else {
      				alert("Error code: " + client.status);
      			}
      		}
      	}
      	client.open("GET", "http://www.whatsmyuseragent.com/");
      	client.send();
      </script>
      

      Actual result:
      A desktop User Agent is shown:

      Expected result:
      An iPhone User Agent is shown.

            ibuziuk@redhat.com Ilya Buziuk
            yradtsevich Yahor Radtsevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: