# Hyperlink in Graphviz node doesn't work

**URL:** <https://talk.observablehq.com/t/hyperlink-in-graphviz-node-doesnt-work/4775>\
**Category:** Help\
**Created:** [March 14, 2021, 5:45am UTC](https://talk.observablehq.com/t/hyperlink-in-graphviz-node-doesnt-work/4775 "2021-03-14T05:45:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brentshields](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/brentshields/32/4666_2.png) [@brentshields](https://talk.observablehq.com/u/brentshields)\
**Post date:** [March 14, 2021, 5:45am UTC](https://talk.observablehq.com/t/hyperlink-in-graphviz-node-doesnt-work/4775/1 "2021-03-14T05:45:10Z")

</div>

I forked the basic graphviz example and added a URL attribute to one of the nodes here: [Graphviz / Brent Shields (he) / Observable](https://observablehq.com/@shields-ownup/graphviz). Clicking on the ‘b’ node in the graph crashes all of the cells in the document. I assume this is related to the sandboxing of the cells, but is there anyway to work around this?

---

<div class="post-metadata">

**Author:** ![tomlarkworthy](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tomlarkworthy/32/5940_2.png) [@tomlarkworthy](https://talk.observablehq.com/u/tomlarkworthy)\
**Post date:** [March 14, 2021, 7:22am UTC](https://talk.observablehq.com/t/hyperlink-in-graphviz-node-doesnt-work/4775/2 "2021-03-14T07:22:31Z")

</div>

The breakage is on an SVG link, minimal example:

```auto
svg`<svg viewBox="0 0 160 40" xmlns="http://www.w3.org/2000/svg">
  <a xlink:href="https://example.com"><text x="10" y="25">link</text></a>
</svg>`

```

Seems fixable. Platform already does some magic to make normal anchor links work from the iframe context, this seems like a gap in that workaround.

I would suggest reporting it in the Github issues page.

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [March 14, 2021, 11:00am UTC](https://talk.observablehq.com/t/hyperlink-in-graphviz-node-doesnt-work/4775/3 "2021-03-14T11:00:38Z")

</div>

Clicking the link attempts to open it inside the iframe. To have links work properly add the attribute ` target="_top"` to each:

```auto
dot`digraph { b [URL="https://google.com" target="_top"]; a -> b; }`

```

---

<div class="post-metadata">

**Author:** ![brentshields](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/brentshields/32/4666_2.png) [@brentshields](https://talk.observablehq.com/u/brentshields)\
**Post date:** [March 14, 2021, 4:30pm UTC](https://talk.observablehq.com/t/hyperlink-in-graphviz-node-doesnt-work/4775/4 "2021-03-14T16:30:50Z")

</div>

Thanks so much, that worked.

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [March 14, 2021, 6:17pm UTC](https://talk.observablehq.com/t/hyperlink-in-graphviz-node-doesnt-work/4775/5 "2021-03-14T18:17:18Z")

</div>

This seems to be a bug in Chrome where it doesn’t respect the page’s `<base target="_top">` for links in SVG. This is not a problem in Safari.
