You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
The application is served from the root of a web server.
The index.html doesn't have a <base> tag. The server sets a session cookie named XSRF-TOKEN with a path set to /. This cookie is visible by the JS code, and is present in the $cookies object. But calling delete $cookies['XSRF-TOKEN'] or $cookies['XSRF-TOKEN'] = undefined does not delete the cookie from the browser.
If, in debug mode, I set the cookiePath variable to '/' (in angular.js, in the cookies API), then the cookie is deleted.
If I add a <base href="/" /> to index.html, then the cookie is also deleted (but I don't see why I would need a base tag when the app is served from the root).
If I don't set the path of the cookie to /, it isn't visible from JavaScript.
Workaround: if I don't set the cookie in the response, from the server, but simply return it as part of the response body (in JSON), and then create the cookie in the browser, using $cookies, everything works fine.
Can some one help with this problem.
It is not deleting cookie on Chrome iether.
I try to delete it using $cookies and also $cookieStore and it is not removing it.
If i try to use both of these commands and then retrieve document.cookie
the cookie is still there.
Is there any reason for that?
Thanks for responses.
The `put`, `putObject` and `remove` methods now take an options parameter
where you can provide additional options for the cookie value, such as `expires`,
`path`, `domain` and `secure`.
Closesangular#8324Closesangular#3988Closesangular#1786Closesangular#950
netman92
pushed a commit
to netman92/angular.js
that referenced
this issue
Aug 8, 2015
The `put`, `putObject` and `remove` methods now take an options parameter
where you can provide additional options for the cookie value, such as `expires`,
`path`, `domain` and `secure`.
Closesangular#8324Closesangular#3988Closesangular#1786Closesangular#950
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Here's the situation:
The application is served from the root of a web server.
The index.html doesn't have a
<base>
tag. The server sets a session cookie named XSRF-TOKEN with a path set to/
. This cookie is visible by the JS code, and is present in the $cookies object. But callingdelete $cookies['XSRF-TOKEN']
or$cookies['XSRF-TOKEN'] = undefined
does not delete the cookie from the browser.If, in debug mode, I set the cookiePath variable to '/' (in angular.js, in the cookies API), then the cookie is deleted.
If I add a
<base href="/" />
to index.html, then the cookie is also deleted (but I don't see why I would need a base tag when the app is served from the root).If I don't set the path of the cookie to
/
, it isn't visible from JavaScript.If I change the following line in angular.js :
to
then the cookie is deleted. But I'm not sure what the goal and importance of the path attribute is in this line.
This is with angular 1.2.0-rc.1.
The text was updated successfully, but these errors were encountered: