Is it possible to alert a user just once about something on his first visit? Can't use cookies because its a static site, only html and javascript are used.
Thanks!
Is it possible to alert a user just once about something on his first visit? Can't use cookies because its a static site, only html and javascript are used.
Thanks!
Can't use cookies because its a static site, only html and javascript are used.
You can still use cookies with javascript.
You can use cookies if it's only HTML and JavaScript... JavaScript can read/write cookies to the browser.
I would set a real basic cookie value, and check that before alerting what you need.
You can use this code (scroll down) to read/write cookies and then do something like this:
// if the cookie doesn't exit,
// it means it's the first time the user is visiting this page
if(!readCookie('boom')) {
// this will only run the first time
alert("something");
// now set the cookie value "boom" for 7 days
createCookie('boom','1',7);
}