document.cookies is empty string
See original GitHub issueI am expecting cookie.save to save a cookie. The following code shows how document.cookies is empty after using the save function.
import cookie from 'react-cookie'
cookie.save('session', 'SESSIONTOKEN')
console.log(document.cookies) // => ""
console.log(cookie.load('session', true)) // => "SESSIONTOKEN"
What am I doing wrong or understanding wrong?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
Javascript document.cookie always returns empty string
Answer: Can happen when there are only cookies with the HttpOnly flag set. No you can't write these cookies from JS, but you...
Read more >Document.cookie returns empty string if any ... - Google Groups
Document.cookie returns empty string if any cookie in the domain has non-ASCII characters. 2214 views.
Read more >Javascript document.cookie always returns empty string
JavaScript : Javascript document. cookie always returns empty string [ Gift : Animated Search Engine : https://bit.ly/AnimSearch ] JavaScript ...
Read more >document.cookie return empty string for the csrf token with ...
Here csrf_token is set using document.cookie. Since that is empty, false value is set. If need more info, let me know. Flags: needinfo?(coderrajput) ......
Read more >Web - Client | XSS Stored 1, I have no cookie WTF ... - Root Me
console.log(document.cookie) on the dev console prints an empty string, and in the cookies section in the browser I don't see any cookies.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This line:
https://github.com/thereactivestack/react-cookie/blob/master/src/cookie.js#L4
is what breaks it. It assumes to be in node when it’s really in the browser.
this library is pretty neat btw.! Thank’s for developing it 😃