Get DOM of SVG residing in iframe
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.
精彩评论