Skip to content

Instantly share code, notes, and snippets.

@cozzbie
Last active June 2, 2020 08:27
Show Gist options
  • Save cozzbie/448f9a427e52821ccf8c9853e403b329 to your computer and use it in GitHub Desktop.
Save cozzbie/448f9a427e52821ccf8c9853e403b329 to your computer and use it in GitHub Desktop.
const body = document.querySelector('body');
const iframe = document.createElement('iframe');
iframe.src = `<link to sound>`;
iframe.allow = 'autoplay';
iframe.style.cssText = `display: none`;
body.appendChild(iframe);
// Definitly a better thing to do this is to have listeners
// on your sound instance.
setTimeout(() => {
this.body.removeChild(iframe);
}, 3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment