Hello everyone, I am attempting to have audio play upon opening or launching a page. I have used the window.onload function, but unfortunately the audio is not playing when the page loads, even though it plays correctly on blur and focus.
I have attempted using both window.onload and <body onload> to trigger the audio playback once the page launches, but it is still not working. The alert message appears, indicating that the page has finished loading, but the sound does not play.
window.onload = function() {
// This function will be executed when the page finishes loading
birdAudio.play();
alert('The page has finished loading!');
};