I’m currently trying to insert a video in a relative div, in fact, I want to display the video on the front page but only when the user is loading the frontpage for the first time. But, it seems that when we click on the menu button homepage, the video is also displaying…
On the code, I created a php page with my video in it, and in my index.php I’m calling this page in a div called ‘popup’, position relative, with a require(‘video.php’).
Thanks for your help !
You can use sessions or cookies to detect whether the user opened the page for the first time or not. With sessions you would:
With cookies the procedure is almost the same:
The difference between the two approaches:
With cookies, you can set an expiration date. In this case the cookie will not be “unset” when the browser is closed. It will be sent by the browser on each page request until it has expired or the user manually deletes the cookies.
With sessions (which normally use cookies behind the scenes) the session variables expire along with session. This normally happens when the user closes the browser, does not perform any activity on the website for few minutes, or manually deletes session cookies.