When the browser call reaches the server it must have the gzip encoding enabled: the request header must contain something like:

Accept-Encoding: gzip, deflate, br All browsers support this but older browsers may not have it.

You don't have to add any extra script tags to get this to work. You reference the js file.

You are serving your files with a node http server that doesn't know what to do with gzip files unless accessed directly.

When getting a request that can handle gzip, the server should check if the requested file also has an archived version of it and serve that instead.

I haven't tested this implementation but it seems to be doing what you need: you have to adjust your node server.

When serving files with nginx or Apache, enabling gzip is a setting.

Hope it helps

Related Query

More Query from same tag