Reputation: 55
What i want is to play an audio clip while this script is being executed
<?php
session_start();
unset($_SESSION["username"]);
echo "<script>
alert('You have Logout successfully and see you next time.');
window.location='AdminLogin.php';
</script>";
?>
Upvotes: 0
Views: 8321
Reputation: 20232
Use this code:
var audio = new Audio('path_to_your_audio_file.mp3');
audio.play();
The path should be pointing to your server, or to another server.
Full Code:
<?php
session_start();
unset($_SESSION["username"]);
echo "<script>
var audio = new Audio('path_to_your_audio_file.mp3');
audio.play();
alert('You have Logout successfully and see you next time.');
window.location='AdminLogin.php';
</script>";
?>
Example:
var audio = new Audio("http://soundbible.com/mp3/sawing-wood-daniel_simon.mp3");
audio.play();
Upvotes: 2
Reputation: 3308
Here is an minimalist solution using javascript.
<script>
new Audio('path_to_your_audioclip').play();
</script>
Just put this piece of code anywhere outside your <?php ?>
, by changing the path_to_your_audioclip
to your clip location.
Upvotes: -1