Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
133
rated 0 times [  140] [ 7]  / answers: 1 / hits: 117429  / 10 Years ago, tue, march 4, 2014, 12:00:00

I'm making a basic jQuery playground site. I am getting Error: net::ERR_CONTENT_LENGTH_MISMATCH is happening on page load and the background images are not loading on the page.


The image in question is 300kb and is also dynamically changing. I am assuming this has something to do with file sizes, but I don't really know what.


HTML used originally:


<p style="margin:0px; padding:0px;">
<img id="background" src="/bg1.jpg" style='width:100%;' border="0" alt="Null">
</p>

JavaScript / jQuery used to change the background:


var changebg = function() {
if (myscore % 20 == 0) {
level++;
document.getElementById("level").innerHTML = "Level: " + level;
$("#level").fadeIn(1500, function(){$("#level").hide()})
backgroundindex++;
if (backgroundindex > 6) {
backgroundindex == Math.floor((Math.random()*6)+1)};
document.getElementById("background").src="/bg"+backgroundindex+".jpg";
};
}

More From » jquery

 Answers
34

I am getting Error: net::ERR_CONTENT_LENGTH_MISMATCH




Have a look at your server logs to determine what the real issue is.



For me the problem lay somewhere between nginx and file permissions:




  • tail -f /usr/local/var/log/nginx/error.log or run nginx -t to determine your conf location, where you could specify a custom log path.

  • refresh the asset in your browser, eg http://localhost:3000/assets/jquery/jquery.js



You may see something like this in the logs:




/usr/local/var/run/nginx/proxy_temp/9/04/0000000049 failed (13:
Permission denied) while reading upstream for file xyz




Heres how I fixed:



sudo nginx -s stop    
sudo rm -rf /usr/local/var/run/nginx/*
sudo nginx

[#72152] Tuesday, March 4, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
amari

Total Points: 736
Total Questions: 111
Total Answers: 90

Location: Saint Pierre and Miquelon
Member since Fri, Jan 28, 2022
2 Years ago
;