0

I want to push (HTTP/2 push, not push notification) manifest.json, is it okay? how should I declare it as? If it's image, usually as=image, css file as=style, for manifest.json?

Edit, to expand info, this is server push using Link header. The reason I want to push is to make it quicker as it's always loaded late. Here's the screenshot for normal loading of manifest.json screenshot

somuch72
  • 358
  • 4
  • 15
  • I haven't used HTTP/2 yet, but [the spec](https://http2.github.io/http2-spec) says nothing about this `as=image` or `as=style` that you refer to. Can you expand on that a bit? Have you tried pushing `manifest.json`? Did it not work? What happened? – Lightness Races in Orbit Nov 15 '19 at 01:10
  • Ah, I guess you're talking about [preloading with the `Link` header](https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content). Please expand your question to give all necessary context and detail, and make sure you take your time over it to make sure it's really the best question it can be (take care! you have a typo right there in the title, for example) – Lightness Races in Orbit Nov 15 '19 at 01:14
  • 1
    Have a read of https://w3c.github.io/preload/#server-push-http-2 and https://w3c.github.io/preload/#as-attribute – Lightness Races in Orbit Nov 15 '19 at 01:18
  • @Lightness Races with Monica Yes, preloading with `Link` header. Thanks for the as-attribute link, can't find anything about json file, should I push it as `script`? – somuch72 Nov 15 '19 at 01:28
  • _"the resource's as attribute is defined via the as link-extension target attribute. ([RFC5988] section 5.4)"_ so follow the link and read. Looks like type might be optional. Again, did you come up against some specific problem? Expand your question with detail. – Lightness Races in Orbit Nov 15 '19 at 02:04
  • @Lightness Races with Monica I found this https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content#What_types_of_content_can_be_preloaded JSON `as` attribute is `fetch` – somuch72 Nov 15 '19 at 03:36

1 Answers1

1

To preload JSON file, whether using html preload or header preload, the as attribute is fetch according to https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content#What_types_of_content_can_be_preloaded

somuch72
  • 358
  • 4
  • 15