Welcome Guest, Not a member yet? Register   Sign In
Server Push/preloading?
#1

I guess i'm behind the tech curve a little lol.

I whipped up a small addition to the Response class last night to make Server Push more pleasant for common resources. Only to realize tonight that Chrome removed http2 server push last fall. It still preloads the elements.

My question is would this be something people would find useful? Obviously, most things can be preloaded as part of the link tag itself. This addition to the Response class does it using headers. Is this a common enough use case to be included in the framework?

PHP Code:
$this->response->push()->style('/assets/app.css');
$this->response->push()->script('/assets/app.js');
$this->response->push()->image('/img/logo.png', ['type => 'image/png']);
$this->response->push()->font('
/fonts/myfont.woff', 'font/woff2');
$this->response->push()->link('
some/path', 'preload', 'video', ['type' => 'video/mp4'); 

If I decide to include them I'll probably rename it to preload() instead of push(), I think.

What do you think? Useful or not?
Reply


Messages In This Thread
Server Push/preloading? - by kilishan - 01-11-2024, 09:36 PM
RE: Server Push/preloading? - by InsiteFX - 01-11-2024, 11:12 PM
RE: Server Push/preloading? - by kenjis - 01-12-2024, 03:04 AM
RE: Server Push/preloading? - by InsiteFX - 01-12-2024, 06:20 AM
RE: Server Push/preloading? - by kenjis - 01-12-2024, 05:45 PM
RE: Server Push/preloading? - by bgeneto - 02-12-2024, 11:56 PM
RE: Server Push/preloading? - by demyr - 02-13-2024, 08:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB