Retro.Phoenix.HTML.Link (Retro v2.2.0) View Source
Toolkit for extending Phoenix.HTML.Link
.
Link to this section Summary
Functions
Generates a external link to the given URL with vulnerability care. Get more details by reading
Link to this section Functions
Generates a external link to the given URL with vulnerability care. Get more details by reading:
- Open link in new tab or window
- Prevent Reverse Tabnabbing Attacks With Proper noopener, noreferrer, and nofollow Attribution
This function is same as Phoenix.HTML.Link.link/2
except that it adds two
additional options:
[
target: "_blank",
rel: "noopener noreferrer"
]
Examples
iex> external_link("open page", to: "https://example.com") |> Phoenix.HTML.safe_to_string
"<a href=\"https://example.com\" rel=\"noopener noreferrer\" target=\"_blank\">open page</a>"
iex> external_link("open page", to: "https://example.com", rel: "nofollow") |> Phoenix.HTML.safe_to_string
"<a href=\"https://example.com\" rel=\"noopener noreferrer nofollow\" target=\"_blank\">open page</a>"