Results 1 to 8 of 8
Thread: cookie or session?
-
03-23-2004, 06:25 AM #1Web Hosting Master
- Join Date
- Mar 2004
- Posts
- 1,303
cookie or session?
Hi,
I am developing a bilangual website where users have choice to select some pre-determined languages. Right now, I am using, but I am not sure if this is a good idea. If user does not want to use cookie, then he/she won't be able to select his desired language but has to use a default language set up by me.
So, is session a better solution?
Thanks
-
03-23-2004, 12:10 PM #2Web Hosting Master
- Join Date
- Aug 2002
- Location
- Superior, CO, USA
- Posts
- 635
I agree that cookies are probably the best way to remember the preference of the user. However, most browsers send the language that the user has selected. For example, my browser sends:
Accept-Language: en-us,en;q=0.5
Based on this you can make an educated guess as to what language to serve to the client. It may not be perfect but it might be better than just sending them the language that you choose.
-
03-23-2004, 12:42 PM #3Web Hosting Master
- Join Date
- Mar 2004
- Posts
- 1,303
hi stdunbar,
That is a good idea. However, my website uses unicode(utf-8) as charset. Therefore, any setting on the user's browser encoding will be change to utf-8 once they visit my website.
I am still very curious how to determine what language a user has selected
Thanks stdunbar!
-
03-23-2004, 12:48 PM #4Junior Guru Wannabe
- Join Date
- Jul 2003
- Location
- Vancouver, BC, Canada
- Posts
- 88
I don't know, but cookies didn't work really well with IE when I tested them - it seemed like IE didn't accept my site's cookies at all. Although, they worked fine in Mozilla and Opera.
-
03-23-2004, 01:05 PM #5Web Hosting Master
- Join Date
- Aug 2002
- Location
- Superior, CO, USA
- Posts
- 635
But UTF-8 is a character set, not a locale. My browser also sends:
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
These are different things. I use English as my language and that can be represented in UTF-8 just fine. But so can French, Spanish and so on. Indeed, if you're using UTF-8 you'll be able to represent alot of languages.
Originally posted by orbitz
hi stdunbar,
That is a good idea. However, my website uses unicode(utf-8) as charset. Therefore, any setting on the user's browser encoding will be change to utf-8 once they visit my website.
I am still very curious how to determine what language a user has selected
Thanks stdunbar!
-
03-23-2004, 01:06 PM #6Aspiring Evangelist
- Join Date
- Mar 2004
- Posts
- 407
Do you mean an ASP/.NET Session? If so then session follows the same rules as a cookie. If the user does not allow cookies, the session will not work either. I personally do not like sessions because they keep info on the persons desktop and on the server which takes up server resources.
However, the session is more secured then the cookie, but in your case it does not matter.Alvin
-
03-23-2004, 02:49 PM #7Web Hosting Master
- Join Date
- Mar 2004
- Posts
- 1,303
stdunbar
ok, I understand now.
-
03-23-2004, 02:51 PM #8Web Hosting Master
- Join Date
- Mar 2004
- Posts
- 1,303
I don't know, but cookies didn't work really well with IE when I tested them - it seemed like IE didn't accept my site's cookies at all. Although, they worked fine in Mozilla and Opera.
Alvinks,
I am using PHP