Looking at
https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints,
what should developers do if they have multiple different targets?
>
> e.g. URL A navigates to "_blank" and URL B navigates "_self"?


They can split the rule in two (or include two rules):

        {
          "prerender": [
           {
            "target_hint": "_blank",
            "urls": ["a.html"]
           },
           {
            "target_hint": "_self",
            "urls": ["b.html"]
           }
           ]
        }

Demo: https://prerender-demos.glitch.me/target-hint-two-links.html

It's even theoretically possible to have the same URL prerendered twice as
noted in the explainer
<https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints:~:text=Note%20that%20if,avoided%20if%20possible.>,
though that's not something we'd recommend, and falling back to document
rules is probably the better option there.


On Wed, 4 Jun 2025 at 15:24, Yoav Weiss (@Shopify) <yoavwe...@chromium.org>
wrote:

> Looking at
> https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints,
> what should developers do if they have multiple different targets?
> e.g. URL A navigates to "_blank" and URL B navigates "_self"?
>
> On Tuesday, June 3, 2025 at 2:43:26 PM UTC+2 Eric Beach wrote:
>
>> I work on Google Meet. For a feature that my subteam is working on which
>> aims to greatly improve user performance and latency, this functionality is
>> critical.
>>
>> On Tuesday, May 20, 2025 at 7:19:53 AM UTC-4 Chromestatus wrote:
>>
>>> Contact emails robe...@chromium.org
>>>
>>
>>> Explainer
>>> https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints
>>>
>>> Specification
>>> https://wicg.github.io/nav-speculation/speculation-rules.html
>>>
>>> Summary
>>>
>>> This extends speculation rules syntax to allow developers to specify the
>>> target_hint field. This field provides a hint to indicate a target
>>> navigable where a prerendered page will eventually be activated. For
>>> example, when _blank is specified as a hint, a prerendered page can be
>>> activated for a navigable opened by window.open(). The field has no effect
>>> on prefetching. The specification allows this field to accept any strings
>>> that are valid as navigable target name or keyword as the value, but this
>>> launch supports only one of "_self" or "_blank" strings. If the hint is not
>>> specified, it's treated like "_self" is specified.
>>>
>>>
>>> Blink component Internals>Preload>Prerender
>>> <https://issues.chromium.org/issues?q=customfield1222907:%22Internals%3EPreload%3EPrerender%22>
>>>
>>> Search tags speculationrules <http:///features#tags:speculationrules>,
>>> prerendering <http:///features#tags:prerendering>
>>>
>>> TAG review https://github.com/w3ctag/design-reviews/issues/931
>>>
>>> TAG review status Issues addressed
>>>
>>> Origin Trial Name SpeculationRulesTargetHint
>>>
>>> Chromium Trial Name SpeculationRulesTargetHint
>>>
>>> Origin Trial documentation link
>>> https://github.com/WICG/nav-speculation/blob/main/triggers.md#window-name-targeting-hints
>>>
>>> WebFeature UseCounter name kSpeculationRulesTargetHintBlank
>>>
>>> Risks
>>>
>>>
>>> Interoperability and Compatibility
>>>
>>> This feature is a small addition to the existing speculation rules
>>> feature. Speculation rules itself is a progressive enhancement, so the
>>> interoperability risks are low. Additionally, the compatibility risks for
>>> this feature are low: if we removed it in the future, it would cause some
>>> prerenders to start failing, but prerendering is never guaranteed to work
>>> and is hard to depend on.
>>>
>>>
>>> *Gecko*: Neutral (
>>> https://github.com/mozilla/standards-positions/issues/620) Mozilla was
>>> notified about this addition to the speculation rules syntax on the overall
>>> speculation rules standards positions thread, and gave an overall neutral
>>> response to the feature.
>>>
>>> *WebKit*: No signal (
>>> https://github.com/WebKit/standards-positions/issues/54)
>>>
>>> *Web developers*: No signals
>>>
>>> *Other signals*: SpeedKit/Baqend
>>> https://github.com/WICG/nav-speculation/issues/374 We also know of a
>>> Google site which has experimented with this feature and successfully used
>>> it to enable prerendering which was previously not possible
>>>
>>> WebView application risks
>>>
>>> Does this intent deprecate or change behavior of existing APIs, such
>>> that it has potentially high risk for Android WebView-based applications?
>>>
>>> None
>>>
>>>
>>> Debuggability
>>>
>>> DevTools supports speculation rules:
>>> https://developer.chrome.com/blog/debugging-speculation-rules/
>>>
>>>
>>> Will this feature be supported on all six Blink platforms (Windows, Mac,
>>> Linux, ChromeOS, Android, and Android WebView)? No
>>>
>>> Android WebView doesn't support speculation rules prerender yet.
>>>
>>>
>>> Is this feature fully tested by web-platform-tests
>>> <https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>
>>> ? Yes
>>>
>>> https://wpt.fyi/results/speculation-rules/prerender
>>>
>>>
>>> Flag name on about://flags
>>> enable-speculation-rules-prerendering-target-hint
>>>
>>> Finch feature name Prerender2InNewTab
>>>
>>> Rollout plan Will ship enabled for all users
>>>
>>> Requires code in //chrome? False
>>>
>>> Tracking bug https://issues.chromium.org/issues/40234240
>>>
>>> Availability expectation Feature is available on Web Platform in M138.
>>>
>>> Sample links
>>> https://prerender2-specrules.glitch.me
>>>
>>> Estimated milestones
>>> Shipping on desktop 138
>>> Origin trial desktop first 135
>>> Origin trial desktop last 138
>>> Shipping on Android 138
>>> Origin trial Android first 135
>>> Origin trial Android last 138
>>>
>>> Anticipated spec changes
>>>
>>> Open questions about a feature may be a source of future web compat or
>>> interop issues. Please list open issues (e.g. links to known github issues
>>> in the project for the feature specification) whose resolution may
>>> introduce web compat/interop risk (e.g., changing to naming or structure of
>>> the API in a non-backward-compatible way).
>>> No spec changes are planned.
>>>
>>> Link to entry on the Chrome Platform Status
>>> https://chromestatus.com/feature/5162540351094784?gate=5144913335549952
>>>
>>> Links to previous Intent discussions Intent to Experiment:
>>> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/67c935cc.2b0a0220.325104.02b6.GAE%40google.com
>>>
>>>
>>> This intent message was generated by Chrome Platform Status
>>> <https://chromestatus.com>.
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "blink-dev" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/chromium.org/d/topic/blink-dev/am_noPAIH5k/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> blink-dev+unsubscr...@chromium.org.
> To view this discussion visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/e49f6e57-52a8-41b8-a0fd-892ba227394fn%40chromium.org
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/e49f6e57-52a8-41b8-a0fd-892ba227394fn%40chromium.org?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to blink-dev+unsubscr...@chromium.org.
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAH6JyLRaGtUhv95TaRDvfONKmURZthfHzVe1Pgkq%2BjtFpue_-g%40mail.gmail.com.

Reply via email to