The Embed object represents an HTML <embed> element.
We can access an <embed> element via document.getElementById()
:
var x = document.getElementById("myEmbed");
Click the button to get the URL of the embedded file.
<!DOCTYPE html> <html> <body> <embed id="myEmbed" src="video.mp4"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w.j ava 2s .c o m*/ var x = document.getElementById("myEmbed").src; document.getElementById("demo").innerHTML = x; } </script> </body> </html>