I'm trying to set a Cookie in a XSS request using XMLHttpRequest.
I found the XMLHttpRequest Specification, and section 4.6.2-5 does seem to suggest that setting Cookie, Cookie2, and some other headers are not allowed, but I was hoping there was a work around.
My (jQuery) code is below, but the resulting query fails as the cookie is NOT set.
$.ajax( {
type : "POST",
url : URL,
data: SOAP_INBOX_MAIL_QUERY,
dataType : "xml",
async: false,
beforeSend : function(xhr) {
var cookie = credentials["COOKIE"];
console.info( "adding cookie: "+ cookie );
xhr.setRequestHeader('Cookie', cookie);
},
success : function(data, textStatus, xmLHttpRequest){
},
error : function(xhr, ajaxOptions, thrownError) {
credentials = null;
}
});