Jump to content

Audio File To Play Once Per Session


Enso

Recommended Posts

Hi Everyone,

 

I'm trying to get an audio file to play on a home page once per visit, but the problem I'm running into is that it plays *every* time a visitor goes to the home page. So, if a user goes to the home page, the file plays; then, if they go to another page on the website and return to the home page, the file plays again. Is there any way to get it to only play once per web browser session?

Link to comment
https://forums.phpfreaks.com/topic/268744-audio-file-to-play-once-per-session/
Share on other sites

I know it's pretty difficult to get used too ... but look at it like this, if I hired a builder to make me a house, and I then requested them to do something that would threaten the integrity of it's structure I would not expect them to do it ... uncomfortable or not, it's a well known fact that people hate music playing or videos when they didn't request them, we have youtube for that. You should try a bit harder to impress the truth on your client in order to steer them from making the wrong decisions ...

 

Why not show them a link to this page, experts in their field say it's the wrong thing to do, ergo, intrusive or not, it's the wrong thing to do.

 

Just 2 cents, have fun :)

Then store a variable in the session when they load the page.

 

 

so something like:

<?php
if( !isset($_SESSION['audio_played'] || !$_SESSION['audio_played']))
{

$_SESSION['audio_played'] = true; //set flag

// code to play the dumb audio file goes here

}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.