Does every web request send the browser\'s cookies?
I\'m not talking page views, but a request for an image, .js
file, etc.
Update If a w
No. Not every request sends the cookies. It depends on the cookie configuration and client-server connection.
For example, if your cookie's secure
option is set to true
then it must be transmitted over a secure HTTPS connection. Means when you see that website with HTTP protocol then these cookies won't be sent by browsers as the secure flag is true.
3 years have passed
There's another reason why a browser wouldn't send cookies. You can add a crossOrigin
attribute to your <script>
tag, and the value to "anonymous"
. This will prevent cookies to be sent to the destination server. 99.9% of the time, your javascripts are static files, and you don't generate that js code based on the request's cookies. If you have 1KB of cookies, and you have 200 resources on your page, then your user is uploading 200KB, and that might take some time on 3G and have zero effect on the result page. Visit HTML attribute: crossorigin for reference.