I have an iframe that has an SVG embedded in it. The SVG is generated by GraphViz so I can't change much in it. What I need is access to the SVG DOM in the parent page.
The source of the iframe is
<iframe id='graph' src='gen-graph.php' />
Any hints on how I can get access to the different nodes (text, polygon) etc of the SVG?
Here's an example that reaches into an external svg document from the parent document.
What you're looking for is the iframe's contentDocument, which can be accessed via yourIFrameElement.contentDocument
. Then use contentDocument as you'd use the normal document
object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With