Amphtml: Warning: `<link rel=preload>` must have a valid `as` value

Created on 8 Mar 2016  Â·  8Comments  Â·  Source: ampproject/amphtml

This is surprising.

Getting this message when loading
http://localhost:8000/max/s/thawing-ridge-70066.herokuapp.com/examples/index.amp.html

Can we always provide a default or make it mandatory?

Lets fix before next dev channel.

High Priority Bug

Most helpful comment

Is there an open Chrome issue for this?

All 8 comments

This doesn't indicate that the as= attribute is missing, it seems this is thrown when the value is wrong. In this case it doesn't like as=document although it seems to be a valid value according to the spec.

as=document might not be supported by the browser yet? Will drop it and not specify as in that case.

I'm still getting this warning

<link rel=preload> must have a validasvalue

@jitendravyas This is a bug in Chrome, so we decided to leave it as is.

Is there an open Chrome issue for this?

When you use preload as rel you must add style as the value like this:
<link rel="preload" href="style.css" as="style">
more info:
https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content

@pedramvdl31 Unless I'm mistaken, this issue is about as="document" rather than as="style" (I could definitely be mistaken here). Seems that Chrome 80 still gives a warning when trying to reload a document that is going to be used in an iframe:

<link rel=preload> must have a valid `as` value

as=document is definitely valid according to the spec: https://www.w3.org/TR/preload/#as-attribute

Also, a heads up to people hitting this page from a search engine (trying to get as=document working, unrelated to AMP), if you want to preload a document from a cross-domain source, prenavigate might be in the wc3 pipeline for that purpose: https://github.com/w3c/resource-hints/issues/82#issuecomment-532072736

Edit: As pointed out here, prenavigation only works for actual navigation - not the use of the hrefed resource in the current page.

document, while in the spec, is not implemented in Chrome (or any browser).
For navigations prefetch is the right primitive, and in the future
prenavigate (which will do the right thing for cross origin navigations
with double-keyed caches).

On Wed, Feb 12, 2020 at 10:32 PM josephrocca notifications@github.com
wrote:

@pedramvdl31 https://github.com/pedramvdl31 Unless I'm mistaken, this
issue is about as="document" rather than as="style" (I could definitely
be mistaken here). Seems that Chrome 80 still gives a warning when trying
to reload a document that is going to be used in an iframe:

must have a valid as value

as=document is definitely valid according to the spec:
https://www.w3.org/TR/preload/#as-attribute

Also, a heads up to people hitting this page from Google (unrelated to
AMP), if you want to preload a document from a cross-domain source,
prenavigate might be in the wc3 pipeline for that purpose: w3c/resource-hints#82
(comment)
https://github.com/w3c/resource-hints/issues/82#issuecomment-532072736

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/ampproject/amphtml/issues/2492?email_source=notifications&email_token=AAAV4T426DIC42HDHCBQ5Y3RCTSPZA5CNFSM4B5NNBQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELTSM7A#issuecomment-585574012,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAV4T6O6M43YP4XOVEOUD3RCTSPZANCNFSM4B5NNBQA
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmajoulet picture gmajoulet  Â·  3Comments

samanthamorco picture samanthamorco  Â·  3Comments

radiovisual picture radiovisual  Â·  3Comments

akshaylive picture akshaylive  Â·  3Comments

choumx picture choumx  Â·  3Comments