How to access the content of the embed tag in HTML
Complete about turn!
Turns out you can, see this link: http://xn--dahlstrm-t4a.net/svg/html/get-embedded-svg-document-script.html
(Also, go and up vote some of Erik Dahlström's other answers to give him some points for me hijacking his answer!)
How to access dom elements of #document from embed tag?
The content of an <embed>
tag is essentially locked Shadow DOM - it's a whole new document that Chrome can access but you can't.
It's easy to check what properties you can access:
var xObj = document.getElementById('xObj');
for (var p in xObj) { var value = null; try { value = xObj[p]; } catch (err) {}
if (value) console.log(p, value);}
<embed id="xObj" src="http://stackoverflow.com"> </embed>
Get an element in an embed tag
Try
var embed = document.getElementById('myPdf');
// Wait for document to load inside embed element
embed.on('load', function() {
embed.getElementById('next').click();
});
(I am using jQuery in this example for adding the event listener, not sure if you are using it on your project?)
Without jQuery you could do:
var embed = document.getElementById('myPdf');
embed.onload = function() {
embed.getElementById('next').click();
};
It might be possible you can not trigger a click event on that button since a user action often must have taken place to trigger click's from js.
Get element in embed tag
Try this
$(".embeddedObject").find("video").attr("id");
DEMO
Related Topics
IE8 Alternative to Window.Scrolly
Running JavaScript in New Window.Open
Chrome Extension Inject Sidebar into Page
Dynamically Changing Stylesheet Path Not Working in Ie and Firefox
Style the Nth Letter in a Span Using CSS
How to Add Line Numbers to All Lines in Google Prettify
A Way to Count Columns in a Responsive Grid
How to Make Div Slide from Right to Left
How to Make a Web Page Show Up Only Once
How to Make a Rotated Element Height:100% of Its Parent
Play Pause HTML5 Video JavaScript
How to Add a List of Images to the Document from an Array of Urls
Google Maps Zoom Control Is Messed Up
Apply Random Color to Class Elements Individually
Make Bootstrap Modal Draggable and Keep Background Usable