peterinwa
04-03-2003, 02:51 AM
I have always EXPECTED cookie data to be good. For example, I will write "lb" or "kg" to a cookie to keep track of how my visitors weigh themselves. Then when they come back, I check for a cookie. If it's null, I default to "lb." But if it's not null, I use the data trusting that it will be good.
I could check to see that it's "lb" or "kg" and then use it and default to "lb" if it's neither, but I've never bothered. I'm wondering if I should?
I spent the better part of the day trying to find a problem which it turned out was caused by a browser. (The previous version of the WebTV simulator didn't store cookies at all; it seems that this one only stores part of them. Unless I'm somehow causing it but my code works fine with IE and N 4 & 7.)
I was saving a cookie containing 18 data fields using "=" as a control code to separate them. Then EXPECTING to find all the data in the cookie I wrote I had a routine that read all 18 fields. Problem was, today there were only about 6. My website hung.
I solved the problem with a simple routine to check for the 18 control codes. If I don't find all 18, I just don't use the cookie and use defaults as if it were null.
I suppose I should start thinking about this possibility more often. I am not willing to code my site for a user without cookies enabled, but I don't want an occasional failure to cause my site to crash.
I could check to see that it's "lb" or "kg" and then use it and default to "lb" if it's neither, but I've never bothered. I'm wondering if I should?
I spent the better part of the day trying to find a problem which it turned out was caused by a browser. (The previous version of the WebTV simulator didn't store cookies at all; it seems that this one only stores part of them. Unless I'm somehow causing it but my code works fine with IE and N 4 & 7.)
I was saving a cookie containing 18 data fields using "=" as a control code to separate them. Then EXPECTING to find all the data in the cookie I wrote I had a routine that read all 18 fields. Problem was, today there were only about 6. My website hung.
I solved the problem with a simple routine to check for the 18 control codes. If I don't find all 18, I just don't use the cookie and use defaults as if it were null.
I suppose I should start thinking about this possibility more often. I am not willing to code my site for a user without cookies enabled, but I don't want an occasional failure to cause my site to crash.