Black Lives Matter. Please consider donating to Black Girls Code today.

Dash Core Components Link rel attribute?

I would like to add a rel=“noreferrer” attribute to my link. For example:

<a href="http://example.org/" rel="noreferrer">example.org</a>

I tried this in my code, but it didn’t work:

dcc.Link("headers", href='http://example.org/', rel='noreferrer')

Is it possible to set the rel attribute with dcc?

If you’re linking to an external site then you can use html.A instead which has a rel argument.

1 Like

That worked, thank you! For anyone else wondering, it would look like this:

html.A("An example link", id='examplelink', href=r'http://httpbin.org/headers', rel='noreferrer')

I have another question if you don’t mind - how would I add <meta name="referrer" content="none"> into the header of the document?

You can pass a list of dictionaries to the meta_tags argument of the Dash constructor, something like

app = dash.Dash(meta_tags=[{"name": "referrer", "content": "none"}])