Domanda

I am working on a page at http://yourworldclocks.juplo.com/. This page loads a /incl/tzs.js where a initNames(); function is defined and called in document-ready. FireBug says that this function is not defined, but it is in tzs.js.

When I look at the request, it returns 465,6 KB, but tzs.js on the server is 701.82 KB. I see no other error messages.

I have never seen that bug before. I have reset my provider's account and reloaded the site, but I still get the same issue. Anyone knows what is happening? Any ideas? Thanks.

P.S.: The site was working well 15 mins ago.

È stato utile?

Soluzione

Restarting Firefox made the issue disappear. Don't know what caused it though.

Altri suggerimenti

Encountered similar behaviour and dug in to find that this is a weirdness of HTTP headers. I was using nginx in my case; not sure what server you were on. The thing is, for defining gzip compression to my resources, I had enabled compression as follows # gzip settings gzip on; gzip_min_length 900; gzip_buffers 4 32k; gzip_types application/x-javascript text/xml text/css application/json; gzip_vary on; # gzip settings end

The important consideration here is the line gzip_min_length 900;. This instructs nginx that if the content size is less than 900 bytes, do not compress that resource.

The file size in my case was 506 bytes (less than 900) so nginx did not compress it. But, it sent the Content-Length of the resource as if it had actually compressed it (566 bytes). (Yes the resource size actually increased on compression. This is to be expected of smaller files, which is why there is a gzip_min_length directive in the first place)

So to resolve this,I simply lowered the threshold of gzip_min_length to 100. Now nginx compresses the file (which bloats it slightly to 566 bytes), and sends the correct Content-Length header as well (566 bytes).

Hope this helps someone!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top