Skip to content

Commit 282b2a0

Browse files
authored
Refine _blank implicit noopener (#2236)
* <a target="_blank"> has implicit noopener as per spec. See: whatwg/html#4330 Removed the wordings that could imply the behavior is vendor-specific. Added links to Browser compatibility for easy reference. * <a>: Merged the two similar notes, added more links. * <area> <form>: Applied the same from 517d127 and c531fc3. Should follow up when browser-compat-data for form is revised. * <a> <area> <form>: Applied the new note box style.
1 parent 1ca251b commit 282b2a0

File tree

4 files changed

+35
-22
lines changed

4 files changed

+35
-22
lines changed

files/en-us/web/api/window/opener/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h3 id="Value">Value</h3>
4747
<code>{{htmlattrxref("rel", "a")}}=noopener</code> on a link, or passing
4848
<code>noopener</code> in the {{domxref("Window.open", "windowFeatures")}} parameter.
4949
</li>
50-
<li>From Firefox 79, windows opened because of links with a {{htmlattrxref("target",
50+
<li>Windows opened because of links with a {{htmlattrxref("target",
5151
"a")}} of <code>_blank</code> don't get an <code>opener</code>, unless explicitly
5252
requested with <code>{{htmlattrxref("rel", "a")}}=opener</code>.</li>
5353
<li>Having a {{HTTPHeader("Cross-Origin-Opener-Policy")}} header with a value of

files/en-us/web/html/element/a/index.html

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ <h2 id="Attributes">Attributes</h2>
4141
<li>Defining a value suggests it as the filename. <code>/</code> and <code>\</code> characters are converted to underscores (<code>_</code>). Filesystems may forbid other characters in filenames, so browsers will adjust the suggested name if necessary.</li>
4242
</ul>
4343

44-
<div class="note"><strong>Notes:</strong>
44+
<div class="notecard note">
45+
<h4>Notes</h4>
4546

4647
<ul>
4748
<li><code>download</code> only works for <a href="/en-US/docs/Web/Security/Same-origin_policy">same-origin URLs</a>, or the <code>blob:</code> and <code>data:</code> schemes.</li>
4849
<li>
49-
<p>Note: if the <code>Content-Disposition</code> header has different information from the <code>download</code> attribute, resulting behavior may differ:</p>
50+
<p>If the <code>Content-Disposition</code> header has different information from the <code>download</code> attribute, resulting behavior may differ:</p>
5051

5152
<ul>
5253
<li>
@@ -89,12 +90,9 @@ <h2 id="Attributes">Attributes</h2>
8990
<li><code>_top</code>: the topmost browsing context (the "highest" context that’s an ancestor of the current one). If no ancestors, behaves as <code>_self</code>.</li>
9091
</ul>
9192

92-
<div class="note">
93-
<p><strong>Note:</strong> When using <code>target</code>, add <code>rel="noreferrer noopener"</code> to avoid exploitation of the <code>window.opener</code> API.</p>
94-
</div>
95-
96-
<div class="note">
97-
<p><strong>Note:</strong> In newer browser versions (e.g. Firefox 79+) setting <code>target="_blank"</code> on <code>&lt;a&gt;</code> elements implicitly provides the same <code>rel</code> behavior as setting <code>rel="noopener"</code>.</p>
93+
<div class="notecard note">
94+
<h4>Note</h4>
95+
<p>Setting <code>target="_blank"</code> on <code>&lt;a&gt;</code> elements implicitly provides the same <code>rel</code> behavior as setting <code><a href="/en-US/docs/Web/HTML/Link_types/noopener">rel="noopener"</a></code> which does not set <code>window.opener</code>. See <a href="#browser_compatibility">browser compatibility</a> for support status.</p>
9896
</div>
9997
</dd>
10098
<dt id="type">{{HTMLAttrDef("type")}}</dt>
@@ -106,23 +104,28 @@ <h3 id="Obsolete_attributes">Obsolete attributes</h3>
106104
<dl>
107105
<dt id="charset">{{HTMLAttrDef("charset")}}{{Obsolete_Inline("HTML5")}}</dt>
108106
<dd>Hinted at the {{Glossary("character encoding")}} of the linked URL.
109-
<div class="note">
110-
<p><strong>Note:</strong> This attribute is obsolete and <strong>should not be used by authors</strong>. Use the HTTP {{HTTPHeader("Content-Type")}} header on the linked URL.</p>
107+
<div class="notecard note">
108+
<h4>Note</h4>
109+
<p>This attribute is obsolete and <strong>should not be used by authors</strong>. Use the HTTP {{HTTPHeader("Content-Type")}} header on the linked URL.</p>
111110
</div>
112111
</dd>
113112
<dt id="coords">{{HTMLAttrDef("coords")}}{{Obsolete_Inline("HTML5")}}</dt>
114113
<dd>Used with <a href="#shape">the <code>shape</code> attribute</a>. A comma-separated list of coordinates.</dd>
115114
<dt id="name">{{HTMLAttrDef("name")}}{{Obsolete_Inline("HTML5")}}</dt>
116115
<dd>Was required to define a possible target location in a page. In HTML 4.01, <code>id</code> and <code>name</code> could both be used on <code>&lt;a&gt;</code>, as long as they had identical values.
117-
<div class="note">
118-
<p><strong>Note:</strong> Use the global attribute {{HTMLAttrxRef("id")}} instead.</p>
116+
<div class="notecard note">
117+
<h4>Note</h4>
118+
<p>Use the global attribute {{HTMLAttrxRef("id")}} instead.</p>
119119
</div>
120120
</dd>
121121
<dt id="rev">{{HTMLAttrDef("rev")}}{{Obsolete_Inline("HTML5")}}</dt>
122122
<dd>Specified a reverse link; the opposite of <a href="#rel">the <code>rel</code> attribute</a>. Deprecated for being very confusing.</dd>
123123
<dt id="shape">{{HTMLAttrDef("shape")}}{{Obsolete_Inline("HTML5")}}</dt>
124124
<dd>The shape of the hyperlink’s region in an image map.
125-
<div class="note"><strong>Note:</strong> Use the {{HTMLElement("area")}} element for image maps instead.</div>
125+
<div class="notecard note">
126+
<h4>Note</h4>
127+
<p>Use the {{HTMLElement("area")}} element for image maps instead.</p>
128+
</div>
126129
</dd>
127130
</dl>
128131

@@ -227,7 +230,8 @@ <h3 id="Linking_to_an_element_on_the_same_page">Linking to an element on the sam
227230
</pre>
228231

229232
<div class="notecard note">
230-
<p><strong>Note:</strong> You can use <code>href="#top"</code> or the empty fragment (<code>href="#"</code>) to link to the top of the current page, <a href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-the-fragment-identifier">as defined in the HTML specification</a>.</p>
233+
<h4>Note</h4>
234+
<p>You can use <code>href="#top"</code> or the empty fragment (<code>href="#"</code>) to link to the top of the current page, <a href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-the-fragment-identifier">as defined in the HTML specification</a>.</p>
231235
</div>
232236

233237
<h3 id="Linking_to_an_email_address">Linking to an email address</h3>
@@ -319,7 +323,7 @@ <h2 id="Security_and_privacy">Security and privacy</h2>
319323

320324
<p><code>&lt;a&gt;</code> elements can have consequences for users’ security and privacy. See <a href="/en-US/docs/Web/Security/Referer_header:_privacy_and_security_concerns"><code>Referer</code> header: privacy and security concerns</a> for information.</p>
321325

322-
<p>Using <code>target="_blank"</code> without <code>rel="noreferrer"</code> and <code>rel="noopener"</code> makes the website vulnerable to {{domxref("window.opener")}} API exploitation attacks (<a href="https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/">vulnerability description</a>), although note that, in newer browser versions (e.g. Firefox 79+) setting <code>target="_blank"</code> implicitly provides the same protection as setting <code>rel="noopener"</code>.</p>
326+
<p>Using <code>target="_blank"</code> without <code><a href="/en-US/docs/Web/HTML/Link_types/noreferrer">rel="noreferrer"</a></code> and <code><a href="/en-US/docs/Web/HTML/Link_types/noopener">rel="noopener"</a></code> makes the website vulnerable to {{domxref("window.opener")}} API exploitation attacks (<a href="https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/">vulnerability description</a>), although note that, in newer browser versions setting <code>target="_blank"</code> implicitly provides the same protection as setting <code>rel="noopener"</code>. See <a href="#browser_compatibility">browser compatibility</a> for details.</p>
323327

324328
<h2 id="Accessibility">Accessibility</h2>
325329

files/en-us/web/html/element/area/index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ <h2 id="Attributes">Attributes</h2>
107107
</ul>
108108
</dd>
109109
<dd>Use this attribute only if the {{htmlattrxref("href", "area")}} attribute is present.
110-
<div class="note">
111-
<p><strong>Note:</strong> In newer browser versions (e.g. Firefox 79+) setting <code>target="_blank"</code> on <code>&lt;area&gt;</code> elements implicitly provides the same <code>rel</code> behavior as setting <code>rel="noopener"</code>.</p>
110+
<div class="notecard note">
111+
<h4>Note</h4>
112+
<p>Setting <code>target="_blank"</code> on <code>&lt;area&gt;</code> elements implicitly provides the same <code>rel</code> behavior as setting <code><a href="/en-US/docs/Web/HTML/Link_types/noopener">rel="noopener"</a></code> which does not set <code>window.opener</code>. See <a href="#browser_compatibility">browser compatibility</a> for support status.</p>
112113
</div>
113114
</dd>
114115
</dl>
@@ -120,8 +121,9 @@ <h3 id="Deprecated_attributes">Deprecated attributes</h3>
120121
<dd>Define a names for the clickable area so that it can be scripted by older browsers.</dd>
121122
<dt>{{htmlattrdef("nohref")}} {{deprecated_inline}}</dt>
122123
<dd>Indicates that no hyperlink exists for the associated area.
123-
<div class="note">
124-
<p><strong>Note:</strong> Since HTML5, omitting the <code>href</code> attribute is sufficient.</p>
124+
<div class="notecard note">
125+
<h4>Note</h4>
126+
<p>Since HTML5, omitting the <code>href</code> attribute is sufficient.</p>
125127
</div>
126128
</dd>
127129
<dt>{{htmlattrdef("tabindex")}} {{deprecated_inline}}</dt>

files/en-us/web/html/element/form/index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ <h2 id="Attributes">Attributes</h2>
5959
<p>This element includes the <a href="/en-US/docs/Web/HTML/Global_attributes">global attributes</a>.</p>
6060

6161
<dl>
62-
<dt>{{htmlattrdef("accept")}} {{obsolete_inline}}</dt>
62+
<dt>{{htmlattrdef("accept")}} {{obsolete_inline("html5")}}</dt>
6363
<dd>Comma-separated <a href="/en-US/docs/Web/SVG/Content_type">content types</a> the server accepts.
64-
<div class="note"><strong>This attribute was removed in HTML5 and should not be used.</strong> Instead, use the {{htmlattrxref("accept", "input")}} attribute on <code>&lt;input type=file&gt;</code> elements.</div>
64+
<div class="notecard note">
65+
<h4>Note</h4>
66+
<p><strong>This attribute was removed in HTML5 and should not be used.</strong> Instead, use the {{htmlattrxref("accept", "input")}} attribute on <code>&lt;input type=file&gt;</code> elements.</p>
67+
</div>
6568
</dd>
6669
<dt>{{htmlattrdef("accept-charset")}}</dt>
6770
<dd>Space-separated <a href="/en-US/docs/Web/Guide/Localizations_and_character_encodings">character encodings</a> the server accepts. The browser uses them in the order in which they are listed. The default value means <a href="/en-US/docs/Web/HTTP/Headers/Content-Encoding">the same encoding as the page</a>.<br>
@@ -127,6 +130,10 @@ <h3 id="Attributes_for_form_submission">Attributes for form submission</h3>
127130
</ul>
128131

129132
<p>This value can be overridden by a {{htmlattrxref("formtarget", "button")}} attribute on a {{HTMLElement("button")}}, <code><a href="/en-US/docs/Web/HTML/Element/input/submit">&lt;input type="submit"&gt;</a></code>, or <code><a href="/en-US/docs/Web/HTML/Element/input/image">&lt;input type="image"&gt;</a></code> element.</p>
133+
<div class="notecard note">
134+
<h4>Note</h4>
135+
<p>Setting <code>target="_blank"</code> on <code>&lt;form&gt;</code> elements implicitly provides the same <code>rel</code> behavior as setting <code><a href="/en-US/docs/Web/HTML/Link_types/noopener">rel="noopener"</a></code> which does not set <code>window.opener</code>.</p>
136+
</div>
130137
</dd>
131138
</dl>
132139

0 commit comments

Comments
 (0)