Skip to content

Instantly share code, notes, and snippets.

@subzey
Created November 13, 2019 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save subzey/a34f9bf92420e51e324cde4b59683a80 to your computer and use it in GitHub Desktop.
Save subzey/a34f9bf92420e51e324cde4b59683a80 to your computer and use it in GitHub Desktop.
iframe autoplay
<!doctype html>
<html>
<head>
<title></title>
</head>
<body>
<script>
function playSound() {
var ifr = document.createElement('iframe');
ifr.allow = 'autoplay';
ifr.srcdoc = '<!doctype html><audio controls autoplay><source src="https://www.tradingview.com/static/sounds/alert/alarm_clock.mp3" type="audio/mp3"></audio>';
document.body.appendChild(ifr);
}
setTimeout(playSound, 1000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment