for a certain project I’d like to have an alert/notification box appear upon a user’s initial visit to a page, and then assuming the user hits the “x” to close the notification, it will then cease to appear on subsequent visits– I’d imagine this requires the setting of a cookie (via PHP), and perhaps the containing alert div responding to the presence or absence of the cookie via jQuery? any basic direction here in how to get started is much appreciated…
Share
You can do this using browser-side cookies: look at the jquery cookie plugin http://plugins.jquery.com/project/Cookie.
EDIT: here’s how I’m using it.
Save helpful notices preserves my helpfulnotices object, so I don’t show any one helpful notice more than it should be shown.
Here’s the code to save the structure using the jquery JSON cookie extension:
and on page load I re-hydrate it: