Get DOM SVG living in iframe

I have an iframe with built-in SVG. SVG is generated by GraphViz, so I cannot change it much. I need access to the SVG DOM on the parent page.

The iframe source is

<iframe id='graph' src='gen-graph.php' /> 

Any tips on how I can access the various nodes (text, polygon), etc. SVG?

+5
source share
1 answer

Here is an example that goes into an external svg document from the parent document.

What you are looking for is an iframe content document document that can be accessed via yourIFrameElement.contentDocument. Then use contentDocument as you will use a regular object document.

+4
source

All Articles