Browser-side suggested HTTP/2 server push

夙愿已清 提交于 2019-12-11 12:15:47

问题


Are there any specific spec'd processes that a browser client can use to dynamically encourage a server to push additional requested items into the browser cache using HTTP/2 server push before the client needs to actually use them (not talking about server-side events or WebSockets, here, btw, but rather HTTP/2 server push)?


回答1:


There is nothing (yet) specified formally for browsers to ask a server to push resources.

A browser could figure out what secondary resources needs to render a primary resource, and may send this information to the server opportunistically on a subsequent request with a HTTP header, but as I said, this is not specified yet.

[Disclaimer, I am the Jetty HTTP/2 maintainer] Servers, on the other hand, may learn about resources that browsers ask, and may build a cache of correlated resources that they can push to clients.

Jetty provides a configurable PushCacheFilter that implements the strategy above, and implemented a HTTP/2 Push Demo.




回答2:


The objective of server push is that the server send additional files (e.g. javascripts, css) along with the requested URL (e.g. an HTML page) to the browser before the browser knows what related files are required, thus saving a round-trip and improve webpage load speed. If the browser already know what resources are needed it can request with normal HTTP calls.



来源:https://stackoverflow.com/questions/31730428/browser-side-suggested-http-2-server-push

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!