Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fab5freddy

macrumors 65816
Original poster
Jan 21, 2007
1,206
7
Heaven or Hell
Hi There, Does anyone know how to install a cookie onto my website ?

I would like to put a cookie onto my website,
so that all visitors that come to my website get my cookie
on their computer, so that when they come back it remembers
their settings.

Any help would be appreciated ;-)

thanks!
 
JavaScript can create cookies. It'll just depend on what "settings" you're trying to save. Your code will need to save those settings as well as read them from the cookie when they return. PHP and other languages can too I'm fairly certain, but have only dealt with them from JavaScript.
 
yeah, i believe php will do the trick.

but i have to read up some more on that.

If anyone knows, please chime in......

thanks!
 
Just my ¢2, but I find the code for PHP cookies to be cleaner than JavaScript's.

Yea, that's very likely. I never feel overly comfortable when I'm doing it with JavaScript, but I have settings that get set during page interactions so it's a little more straight forward to save them there. I suppose I could offload it to a PHP script via AJAX though.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.