Results 1 to 2 of 2
Apr 14, 2010, 05:48 #1
How to do something for first time visitors only
I'm thinking I may have a need to do something for first time visitors only.
Perhaps just start off to at the top of the post have something like:
First time here? Check out our "Getting Started" Page
I want to put a cookie or something on someones computer so that that text will only show up to first time visitors (at least if they leave their cookies intact.)
What would be the syntax for that?
Apr 14, 2010, 09:20 #2
- Join Date
- Jun 2007
- San Diego, CA
- 0 Post(s)
- 0 Thread(s)
Yeah, you want to use a cookie. Depending on how informal your needs are, it doesn't need to be much. For the case you're discussing, you don't even need to put anything in the cookie, just save a cookie on your visitor's computer and then test for its existence. If the cookie exists, you know they've been to your site before. If they don't have the cookie they are either first time visitors or they've cleared their cookies (but there's no way to determine which). If you actually want to preserve some information, then you can use the cookie to save it. (I presume this is how sitepoint auto-authenticates you when you return after a few days. Even a session shouldn't hold over that time frame). There are good tutorials at W3Schools and Quirksmode (both excellent web development sites to check out if you haven't).
http://www.quirksmode.org/js/cookies.htmlWhatever you can do or dream you can, begin it.
Boldness has genius, power and magic in it. Begin it now.
Chroniclemaster1, Founder of Earth Chronicle
A Growing History of our Planet, by our Planet, for our Planet.