How to access the content of the "embed" tag in HTML

Solution 1:

Use .getSVGDocument(). This seems to work for <embed>, <object> and <iframe>:

document.getElementById('svgsource').getSVGDocument()

For <object> or <iframe> you can also use .contentDocument:

document.getElementById('svgsource').contentDocument

For IE7 or IE8, I believe you are out of luck.

Solution 2:

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!)