Reputation: 1
So I know browsers limit the cookie number to something like 200 ...or whatever (the idea is that there is a limit).
I need to mark a site's page as viewed by the current visitor, so I'm setting a cookie viewed=true
.
How can I set a cookie only for a certain page? I know it's possible, I've seen sites doing this...
Let's say I have 10.000 pages and a visitors views them all. Would browsers complain if there are like 10.000 cookies set on his computer for each of these pages? Is there a cookie limit for the entire site too (all pages together) ?
better explanation of what I want:
Cookies can be set as global (for the entire site, visible on all pages), or local (for a certain page only).
How can I set a local cookie? For example a cookie that's only accessible from site.com/?page=blablawhatever
Does the cookie number browser limit take in consideration all local cookies too, or just the cookies for the current site page?
Upvotes: 0
Views: 537
Reputation: 78540
I think the ideal way would be to set a user ID cookie and, like the others said, store any information tied to that user in your database.
Upvotes: 1
Reputation: 146310
Instead of using cookies (which is on the user's end).
When a user goes to one of your pages, save to the data base that he/she went there.
Before the database save check of the user was already there before, and if that is true then don't save it to the database.
Upvotes: 0
Reputation: 23075
You can set a session cookie and store the viewed pages on the server.
Upvotes: 0