How would I set cookies such that a video only plays automatically on the first visit only, afterwards if they want to watch it, it must be played manually?
Here's what I used on a project:
if (document.cookie.length == 0 || document.cookie.indexOf("MYCOOKIENAME=") == -1) {
// I set the path to / so once they'd seen it once on the site they wouldn't
// see it on other pages.
document.cookie = "MYCOOKIENAME=true; path=/;";
// START VIDEO PLAYING HERE.
}
I didn't really want the overhead of adding a cookie library.
Plugging my code into Oliver Moran's HTML gives you: