How can I check if embed tag exist in my html.
I’ve created this tag through javascript
soundEmbed = document.createElement("embed");
soundEmbed.setAttribute("src", "notify.wav");
soundEmbed.setAttribute("hidden", true);
soundEmbed.setAttribute("autostart", true);
soundEmbed.setAttribute("loop", false);
document.body.appendChild(soundEmbed);
but since I am using autorefresh and appendChild, every time it refresh it creates additional sound.
Using appendChild, I think I’ve got many embed tags. That’s what I think maybe the cause of additional sound.
Add
soundEmbed.id = "__soundEmbed";before appending. Then, surround the entire thing with: