35,140 questions
1509
votes
9
answers
674k
views
Local Storage vs Cookies
Are there any differences in using local storage to replace cookie functionality other than the obvious compatibility issues?
I want to reduce load times on my websites by moving all cookies into ...
1184
votes
18
answers
1.2m
views
How do I expire a PHP session after 30 minutes?
I need to keep a session alive for 30 minutes and then destroy it.
783
votes
4
answers
1.8m
views
Set cookie and get cookie with JavaScript [duplicate]
I'm trying to set a cookie depending on which CSS file I choose in my HTML. I have a form with a list of options, and different CSS files as values. When I choose a file, it should be saved to a ...
610
votes
49
answers
1.4m
views
Get cookie by name
I have a getter to get the value from a cookie.
Now I have 2 cookies by the name shares= and by the name obligations= .
I want to make this getter only to get the values from the obligations ...
555
votes
4
answers
342k
views
What is the best way to implement "remember me" for a website? [closed]
I want my website to have a checkbox that users can click so that they will not have to log in each time they visit my website. I know I will need to store a cookie on their computer to implement this,...
484
votes
10
answers
336k
views
How do browser cookie domains work?
Due to weird domain/subdomain cookie issues that I'm getting, I'd like to know how browsers handle cookies. If they do it in different ways, it would also be nice to know the differences.
In other ...
449
votes
28
answers
783k
views
Clearing all cookies with JavaScript
How do you delete all the cookies for the current domain using JavaScript?
398
votes
22
answers
246k
views
Cookie blocked/not saved in IFRAME in Internet Explorer
I have two websites, example.com and anotherexample.net.
On anotherexample.net/page.html I have IFRAME SRC="http://example.com/someform.asp". That iframe displays a form to submit to example....
383
votes
8
answers
241k
views
Where to store JWT in browser? How to protect against CSRF?
I know cookie-based authentication. SSL and HttpOnly flags can be applied to protect cookie-based authentication from MITM and XSS. However, more special measures will be needed to apply in order to ...
368
votes
18
answers
622k
views
Cross-Domain Cookies
I have two webapps WebApp1 and WebApp2 in two different domains.
I am setting a cookie in WebApp1 in the HttpResponse.
How to read the same cookie from HttpRequest in WebApp2?
I know it sounds weird ...
357
votes
23
answers
391k
views
How do I create and read a value from cookie with javascript?
How can I create and read a value from a cookie in JavaScript?
354
votes
25
answers
810k
views
How to remove a cookie in PHP?
When I want to remove a Cookie I try
unset($_COOKIE['hello']);
I see in my cookie browser from firefox that the cookie still exists. How can I really remove the cookie?
330
votes
3
answers
248k
views
How does cookie-based authentication work?
What would be a step-by-step description of how cookie-based authentication work?
I've never done anything involving either authentication or cookies. What does the browser need to do? What does the ...
310
votes
26
answers
481k
views
Cookies on localhost with explicit domain
I must be missing some basic thing about cookies. On localhost, when I set a cookie on server side and specify the domain explicitly as localhost (or .localhost). the cookie does not seem to be ...
286
votes
16
answers
361k
views
Set cookies for cross origin requests
How to share cookies cross origin? More specifically, how to use the Set-Cookie header in combination with the header Access-Control-Allow-Origin?
Here's an explanation of my situation:
I am ...
274
votes
8
answers
134k
views
Does every web request send the browser cookies?
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 web page has 50 elements, that is 50 requests. Why would it ...
269
votes
6
answers
159k
views
JWT vs cookies for token-based authentication
I read some posts about "JWT vs Cookie" but they only made me more confused...
I want some clarification, when people talking about "token-based authentication vs cookies", cookies here merely refer ...
261
votes
9
answers
190k
views
Token Authentication vs. Cookies
What is the difference between token authentication and authentication using cookies?
I am trying to implement the Ember Auth Rails Demo but I do not understand the reasons behind using token ...
247
votes
15
answers
394k
views
Set a cookie to never expire
Looking at the php documentation on setting a cookie I see that I can set an expiration date for the cookie. You can set the cookie to expire at the end of the browser session or at some time in the ...
241
votes
11
answers
375k
views
How to set a cookie for another domain
Say I have a website called a.com, and when a specific page of this site is loaded, say page link, I like to set a cookie for another site called b.com, then redirect the user to b.com.
I mean, on ...
231
votes
22
answers
249k
views
How do I uniquely identify computers visiting my web site?
I need to figure out a way uniquely identify each computer which visits the web site I am creating. Does anybody have any advice on how to achieve this?
Because i want the solution to work on all ...
218
votes
4
answers
709k
views
Create, read, and erase cookies with jQuery [duplicate]
Somebody help me. How to create, read and erase some cookies with jQuery ?
214
votes
5
answers
259k
views
What is the difference between server side cookie and client side cookie?
What is the difference between creating cookies on the server and on the client? Are these called server side cookies and client side cookies? Is there a way to create cookies that can only be read on ...
208
votes
9
answers
471k
views
Delete cookie by name?
How can I delete a specific cookie with the name roundcube_sessauth?
Shouldn't the following:
function del_cookie(name) {
document.cookie = 'roundcube_sessauth' +
'=; expires=Thu, 01-Jan-70 ...
202
votes
15
answers
102k
views
Is there a setting on Google Analytics to suppress use of cookies for users who have not yet given consent
According to EU Article 5(3) of the E-Privacy Directive (a.k.a 'The Cookie Laws'), web sites that target EU users have to gain opt-in consent from users before they set a cookie.
See ICO Guidance
I ...