We can create an <embed> element via the document.createElement()
method:
var x = document.createElement("EMBED");
Click the button to create an EMBED element with an embedded animation.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <script> function myFunction() {// w ww.ja v a 2s. c om var x = document.createElement("EMBED"); x.setAttribute("src", "video.mp4"); document.body.appendChild(x); } </script> </body> </html>