I sent a cookie from server side
ResponseBuilder response = Response.ok( (Object) file );
response.header( "Set-Cookie", "fileDownload=test");
I can already view it under the 'Response Header' of the f12 developer tools console. However, document.cookie returns an empty string. The HttpOnly
attribute is also unchecked. I'm also not in incognito mode and have cookies enabled. I've already tried changing the localhost address in case it was a web server problem. Is there a way to check the cookie with java script? I just need to check if it has been passed.
Fixed by adding "path" & "domain" parameter.
credits to Andres @bismarck Not sure. But you would probably need to specify the "path" & "domain" parameter. For example / as path and "" as domain. Please check this stackoverflow.com/questions/1134290/… – Andrés