I have this code
setTimeout(function () {
$("#videoOverlay").fadeIn();
document.getElementById("video").play();
}, 8000);
This means 8 seconds after loading, a pop-up will come up and a video will play. I only want this to come up the first time I visit the site. How can I do this with jQuery?
you could try this jquery cookie plugin https://github.com/js-cookie/js-cookie
and then you can use it with
Try with localStorage instead of cookie:
To delete it:
With local storage, web applications can store data locally within the user's browser.
What is HTML Local Storage?
Before HTML5, application data had to be stored in cookies, included in every server request. Local storage is more secure, and large amounts of data can be stored locally, without affecting website performance.
Unlike cookies, the storage limit is far larger (at least 5MB) and information is never transferred to the server.
Local storage is per origin (per domain and protocol). All pages, from one origin, can store and access the same data.
You can also use sessionStorage object that is equal to the localStorage object, except that it stores the data for only one session. The data is deleted when the user closes the specific browser tab.