I need to read the Location
header using XHR. I have added an Access-Control-Expose-Headers
header to the OPTIONS response and to the response where I need to read the header:
Access-Control-Expose-Headers: Location
This works in Chrome, Firefox and IE10, but not in Safari 5.1.7.
Does Safari support the Access-Control-Expose-Headers
header?
After glancing at versions of the
CORS
spec, my guess is thatSafari 5.1
(and similar versions) were using a build of webkit that did not include support for theAccess-Control-Expose-Headers
header. This wasn't added to theCORS
spec draft until July of 2010.Safari 5.1
was released in July of 2011. According to this message thread,Access-Control-Expose-Headers
support wasn't added to webkit until sometime after November 2011, which meansSafari 5.1
definitely did not support this. According to this webkit/safari bug support wasn't added until mid-January 2012, meaning that the earliest version to contain this support would be 5.1.7 (but possibly even later).