Bug Tracker

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#4453 closed bug (worksforme)

Ajax issues on Safari 3

Reported by: kwhinnery Owned by:
Priority: major Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:


When you use headers to set the "Content-Type" header for a request, this breaks in Safari. jQuery parses the dataType parameter and sets the "Content-Type" header once, which usually is fine, but if I try and manually set "Content-Type" header in the beforeSend method, Safari combines the default with the header I set:


url: 'foos.json', data: myJsonString, beforeSend: function(xhr) {


}, success: function(data) {

do something



In Safari, because jQuery defaults "Content-Type" to "application/x-www-form-urlencoded", the text of the "Content-Type" header is set to

"Content-Type": "application/x-www-form-urlencoded, application/json"

Which obviously does not work. Really Safari should just overwrite the header's content when it is reset, but it does not. The workaround is of course to just use the contentType parameter to $.ajax, but I should technically be able to set the header and have the same behavior.

Change History (2)

comment:1 Changed 13 years ago by dmethvin

Resolution: worksforme
Status: newclosed

Since there is a documented way to set the Content-Type, it seems like a second way is not needed. There is already an enhancement ticket open for more general header handling in #1118 and this might be addressed if that ticket is tackled.

comment:2 Changed 13 years ago by Rick Waldron

#1118 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.