You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: triggers.md
+20-7Lines changed: 20 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -143,25 +143,38 @@ We require that user agents discard any rules with requirements that are not rec
143
143
144
144
### Window name targeting hints
145
145
146
-
It is desired by developers to further maximize pre-rendering capability by supporting prerendering pages into different windows. However, for implementation reasons, it can be difficult for user agents to prerender content without knowing which window it will end up in. For example, the browser might prerender content assuming that it will be activated in the current window, replacing the current content, but then the user might end up clicking on an `<a href="page.html" target="_blank">` link, so the prerendered content is wasted.
146
+
It is desired by developers to further maximize prerendering capability by supporting prerendering pages into different windows. However, for implementation reasons, it can be difficult for user agents to prerender content without knowing which window it will end up in. For example, the browser might prerender content assuming that it will be activated in the current window, replacing the current content, but then the user might end up clicking on an `<a href="page.html" target="_blank">` link, or the web developer might open the page using `window.open('page.html')`, causing the prerendered content is wasted.
147
147
148
-
To help with this, `"prerender"` rules can have a `"target_hint"` field, which contains a [valid browsing context name or keyword](https://html.spec.whatwg.org/#valid-browsing-context-name-or-keyword) indicating where the page expects the prerendered content to be activated. (The name "target" comes from the HTML `target=""` attribute on hyperlinks.)
148
+
When using [document rules](#document-rules) that target `<a>` elements, the browser can infer the window name target automatically:
However, when using [list rules](#list-rules), where the developer prerenders specific URLs (e.g., in anticipation of them being opened from JavaScript), a bit more setup is needed. For such cases, `"prerender"` rules can have a `"target_hint"` field, which contains a [valid navigable target name or keyword](https://html.spec.whatwg.org/#valid-navigable-target-name-or-keyword) indicating where the page expects the prerendered content to be activated. (The name "target" comes from the HTML `target=""` attribute on hyperlinks.)
This is just a hint, and is not binding on the implementation. Indeed, we hope that it one day becomes unnecessary, and all implementations can activate prerendered content into any target window. At that point, the field can be safely ignored, and removed from the specification. But at least for Chromium, getting to that point might take a year or so of engineering effort, so in the meantime `"target_hint"` gives developers a way to use prerendering in combination with new windows.
175
+
This is just a hint, and is not binding on the implementation. It's possible one day it will not be necessary for any implementations. At that point, the field can be safely ignored, and removed from the specification. But at least for Chromium, the engineering work for creating prerendering contexts which can be activated into any tab is currently infeasible, so in the meantime `"target_hint"` gives developers a way to use prerendering in combination with new windows.
163
176
164
-
To check Chromium's progress on removing the `target_hint` field, see [this issue](https://crbug.com/361129302).
177
+
(To check Chromium's progress on eventually removing the `target_hint` field, see [this issue](https://crbug.com/361129302).)
165
178
166
179
Note that if a page is truly unsure whether a given URL will be prerendered into the current window or a new one, they could include prerendering rules for multiple target windows:
0 commit comments