I want to check whether the web browser supports cookies, before I set cookies. How to do it using python or django. I didnt find it on google and python document and django doc? any one knows? thx
Asked
Active
Viewed 290 times
1 Answers
2
Check setting test cookies to test whether the user's browser accepts cookies.

Aamir Rind
- 38,793
- 23
- 126
- 164
-
this doc is talking about sessions,right? Does it work fine for cookies? I find `set_cookie` in [Request and response objects](https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpResponse.set_cookie) @Aamir Adnan – Nick Dong Jan 18 '13 at 09:10
-
-
@NickDong your question makes no sense. The answer quite clearly refers to setting test *cookies* to check *cookie* support. The fact that it's implemented as part of the sessions framework is completely irrelevant. – Daniel Roseman Jan 18 '13 at 09:56
-
Please read the doc, it is defined there that you need to set the test cookie first using `set_test_cookie() ` and then in other view check if it is worked using `test_cookie_worked()`. Unfortunately two requests are involved in this process. There is no direct way of checking this. – Aamir Rind Jan 18 '13 at 10:05
-
@Aamir Adnan I still confused about it call two functions in a same view call in [setting-test-cookies](https://docs.djangoproject.com/en/1.0/topics/http/sessions/#setting-test-cookies) – Nick Dong Jan 18 '13 at 10:23
-
-
@NickDong what i mean is that there are two requests involved in the process. You can redirect to the same view where you set the cookie to further test if it is worked. have you looked into the `login` example mentioned in the link i mention? – Aamir Rind Jan 19 '13 at 13:12
-
So basically there's no useful way of doing it; just try to set the cookie and hope it works. – Dissident Rage Aug 28 '14 at 14:53