Solved

Why does Safari does not allow trailing space in header value

Posted on 2016-10-02
5
57 Views
Last Modified: 2016-10-16
HI,
I noticed that especially in safari if i made an ajax call say like :

headers : {"dsds" : "asdasdas  "}
As this has a trailing space at the end... This will result in an exception.
What could be the reason for this.. As this is not happening for other browsers ??

Thanks
0
Comment
Question by:Rohit Bajaj
  • 3
  • 2
5 Comments
 
LVL 52

Expert Comment

by:Julian Hansen
ID: 41826064
We need a context for this, a link and / or screen shot, a full description of the error and a look at the underlying code.
0
 

Author Comment

by:Rohit Bajaj
ID: 41831191
Hi,
I have attached the screenshot of safari console tab. Here if i give a trailing space at the end of a request header it throws an exception otherwise it just runs fine...
Screen-Shot-2016-10-06-at-11.11.17-A.png
0
 
LVL 52

Expert Comment

by:Julian Hansen
ID: 41831216
Still not enough - we need to see the code.

Sidebar - is the space on the end necessary - why not simply trim it before sending.
0
 

Author Comment

by:Rohit Bajaj
ID: 41843224
Thats the whole code in the screenshot just create an xhr request and add an header with a trailing space at the end... It throws an error this does not happen in chrome.. or firefox...
Yes thats what i am planning to do just trim the space before sending....
Just wanted to know if there is any possible reason why safari has done that  and not chrome...
0
 
LVL 52

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 41843354
This bug report seems to deal with the issue

https://github.com/jquery/jquery/issues/3055

Basically it says that a space should be allowed but that there does appear to be an issue with Safari so for now I would just trim the value.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Several part series to implement Internet Explorer 11 Enterprise Mode
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now