i'm having a very strange issue here
i want to display an alert with javascript with an audio looping on the background
i managed to do it but it won't work in Chrome
it works perfectly in Firefox, Edge, IE but not Chrome -_-
in chrome the audio is looping only when you clic OK on the alert
Here is the code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="popup alert">
<title>This is a popup alert</title>
<style type="text/css">
body
{
background-image: url('image.png');
background-repeat: no-repeat;
background-size: cover;
}
</style>
</head>
<body>
<div align="center" id="text">
<h1>title text</h1>
<br>
<h1>title 2 text 2</h1>
<iframe src="silence.mp3" allow="autoplay" id="audio"
style="display:none"></iframe>
<audio controls autoplay loop style="display:none">
<source src="0564.ogg" type="audio/ogg">
</audio>
</div>
<script type="text/javascript">
function popup()
{
window.alert("Hello");
}
window.onload = setTimeout("popup()", 500);
</script>
</body>
</html>
Can you tell me why Chrome is making it soooooo hard ?
thank you