How to call compressed HTML file with gz?

Asked

Viewed 110 times

1

I’m starting to use gzip, I compressed a JS file but when I call it in HTML, the error in the console. IN HTML

<script src="/presencial/includes/jorge_includes/all/js/main.js.gz/main.js"></script>

In the folder is as follows: inserir a descrição da imagem aqui On the console the file functions are not recognized.

1 answer

1


GZIP unzipping files is part of the HTTP / 1.1 protocol that is not used by browsers to upload local files. So I guess the short answer is no. I’m sorry!

You can resort to unzipped files or unzip them before loading the web page or running an HTTP daemon (web server) on the local machine that serves files to the web browser.

Reference:

hope it helps

  • Thank you very much, I will look into how to do it, I am starting to use gzip now so I will get a little bit in the beginning. Hugs!

  • Just one more thing, where I would put the Accept-Encoding: gzip, deflate ?

  • @Jorge in the request headers, on the client side

Browser other questions tagged

You are not signed in. Login or sign up in order to post.