carpentries / carpentries/workshop-template

External links should open a new browser tab

Open
#859 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
270
Forks
531
Avg merge
5d 6h
Merged PRs (30d)
1

Description

I think links to external URLs, at least to non-Carpentries websites should open a new browser tab, by adding `target="_blank"` to their `` tags.
(If deemed sensible for security, see below, also `rel="noopener"` could be added.)

My reasoning is: For users reading the course description for the first time, it feels unexpected to open _external_ links into the same tab. It disrupts reading the course description, forcing the user to either go back-and-forth or explicitly use "open in a new tab". For example, when clicking on the location link to OpenStreetMap, I'm expecting a new tab to open, since it's a different website with a specific goal, and I usually want to keep reading the course description.

I'm aware that at least one similar discussion (#528) resulted in rejection of adding `target="_blank"`, however my proposal is smaller in scope: My suggestion is to add it to _external_ links only, not to _all_ links.

In that discussion, also "potential issues" are mentioned, probably hinting at potential security and privacy issues mentioned at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#security_and_privacy.

Quoting the relevant section:

> [Security and privacy](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#security_and_privacy)
>
> `
` elements can have consequences for users' security and privacy.
> See [Referer header: privacy and security concerns](https://developer.mozilla.org/en-US/docs/Web/Security/Referer_header:_privacy_and_security_concerns) for information.
>
> Using `target="_blank"` without [rel="noreferrer"](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/noreferrer) and [rel="noopener"](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/noopener) makes the website vulnerable to [window.opener](https://developer.mozilla.org/en-US/docs/Web/API/Window/opener) API exploitation attacks, although note that, in newer browser versions setting `target="_blank"` implicitly provides the same protection as setting `rel="noopener"`.
> See [browser compatibility](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#browser_compatibility) for details.

Accordingly, in case it's accepted to add `target="_blank"` to external links, we could also add `rel="noopener"` to avoid risks of security or privacy with older browsers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.