Skip to content

Prototype add extra parameter on Ajax Requests made from Google Chrome using Post #150

@jwestbrook

Description

@jwestbrook

previous lighthouse ticket #1399
by Pablo Biscayart


From the Javascript code in my web application, I do the following call:

request = new Ajax.Request(url, { method: "POST", parameters: qstring, onComplete: Process_Response } );

Assuming that the url and qstring are correct (the call works fine and work on Firefox), the flow will lead to Ajax.Request in prototype, which contains the following lines:

if (params = Object.toQueryString(params)) {

  // when GET, append parameters to URL
  if (this.method == 'get')
    this.url += (this.url.include('?') ? '&' : '?') + params;
  else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
    params += '&_=';
}

This code adds an extra parameter ("_") to the query string when using Chrome, and when the flow reaches the following (located below in a try-catch block after the previous code):

this.body = this.method == 'post' ? (this.options.postBody || params) : null;
this.transport.send(this.body);

the call to the URL will fail due to signature mismatch, and my web app stops working. That hard-wiring of the browser names is pretty ugly indeed. Is this solvable in a way that you don't discriminate among browsers?
This looks the same in 1.6.0 and 1.6.0.2. If I was not clear enough, please contact me and accept my apologies.

Thank you,
Pablo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions