Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8316029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:15:54+00:00 2026-06-08T21:15:54+00:00

I know it kind sounds silly … it should work there … but :

  • 0

I know it kind sounds silly … it should work there … but :

function fetch(id){
    var fetch = new XMLHttpRequest();
    fetch.open("GET", "/upload/status?X-Progress-ID=" + id);
    fetch.onreadystatechange = function () {
      console.log(fetch.readyState);
    }
    fetch.send(null);
}

This code works in IE , in firefox … i get all 4 states returned … but when i try it in chrome i get absolutely nothing … and i have absolutely no idea why…

I think you have already guessed the question , why it doesn’t work ?

EDIT:

Changed the code a little bit … As you have maybe already guessed , i work with nginx upload progress module , and this function is called everysecond to get the progress of the uploaded file …

EDIT 1

Well i tried to rewrite the thing $.ajax() , and i basically got the same result .. ie , firefox works , and chrome just gives me nothing . Here is a full code of the page:

<!doctype html>
<html lang="ru">
<head>
  <meta charset="utf-8">
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
  <script src="static/js/jquery-ui-1.8.21.custom.min.js" type="text/javascript"></script>
  <script>
    function add() {
      if (parseInt(document.getElementById('count').getAttribute('value')) < 8) {
        var input = document.createElement('input');
        input.setAttribute('type','file');
        input.setAttribute('multiple','');
        input.setAttribute('name','file[]');
        document.getElementById('multiple').appendChild(input);
        document.getElementById('multiple').appendChild(document.createElement('br'));
        document.getElementById('count').setAttribute('value',parseInt(document.getElementById('count').getAttribute('value'))+1);
      }
      else {
        alert('Можно загрузить не более 8 файлов за раз.');
      }
    }
    function progress() {
      var ms = new Date().getTime() / 1000;
      rq = 0;
      id = "";
      for (i = 0; i < 32; i++) {
        id += Math.floor(Math.random() * 16).toString(16);
      }
      document.getElementById('upload').action = "/upload/share?X-Progress-ID=" + id;
//      console.log("/upload/share?X-Progress-ID=" + id);
      document.getElementById('status').style.display = 'block'
      interval = window.setInterval(function () { fetch(id, ms); }, 1000);
      return true;
    }
    function fetch(id, ms) {
//      console.log("/upload/status?X-Progress-ID=" + id);


      $.ajax({
        type: "GET",
        url: "/upload/status?X-Progress-ID="+id,
        dataType: 'text',
        complete: function(upload) {
          console.log('test');
          alert('test');
        }
      });

//      var fetch = new XMLHttpRequest();
//      fetch.open("GET", "/upload/status", 1);
//      fetch.setRequestHeader("X-Progress-ID", id);
//      fetch.open("GET", "/upload/status?X-Progress-ID=" + id);
//      fetch.setRequestHeader("X-Progress-ID", id);

//      fetch.onreadystatechange = function () {
//        console.log('rorororo');
//        console.log(fetch.readyState);
//        if (fetch.readyState == 3) {
//          console.log(fetch.responseText);
//
////          if (fetch.status == 200) {
//
//            var now = new Date().getTime() / 1000;
//            var upload = eval(fetch.responseText);
//
//            if (upload.state == 'uploading') {
//              var diff = upload.size - upload.received;
//              var rate = upload.received / upload.size;
//              var elapsed = now - ms;
//              var speed = upload.received - rq; rq = upload.received;
//              var remaining = (upload.size - upload.received) / speed;
//              var uReceived = parseInt(upload.received) + ' bytes';
//              var uDiff = parseInt(diff) + ' bytes';
//              var tTotal = parseInt(elapsed + remaining) + ' secs';
//              var tElapsed = parseInt(elapsed) + ' secs';
//              var tRemaining = parseInt(remaining) + ' secs';
//              var percent = Math.round(100*rate) + '%';
//              var uSpeed = speed + ' bytes/sec';
//              document.getElementById('length').firstChild.nodeValue = parseInt(upload.size) + ' bytes';
//              document.getElementById('sent').firstChild.nodeValue = uReceived;
//              document.getElementById('offset').firstChild.nodeValue = uDiff;
//              document.getElementById('total').firstChild.nodeValue = tTotal;
//              document.getElementById('elapsed').firstChild.nodeValue = tElapsed;
//              document.getElementById('remaining').firstChild.nodeValue = tRemaining;
//              document.getElementById('speed').firstChild.nodeValue = uSpeed;
//              document.getElementById('bar').firstChild.nodeValue = percent;
//              document.getElementById('bar').style.width = percent
//            }
//            else {
//              window.clearTimeout(interval);
//            }
////          }
//        }

//      }
//      fetch.send(null);
    }
  </script>
</head>
<body>
<form method="post" enctype="multipart/form-data" id="upload" onsubmit="progress();">
  <input type="hidden" id="count" value="1" />
  <input type="hidden" value="GOBLEBOELBOE" name="secret">
  <div id="multiple">
    <input type="file" name="file[]" multiple /><br>
  </div>
  <input type="submit">
  <a href="#" onclick="add();">add();</a>
</form>
<div id="status" style="display: none;">
  <table width="100%">
    <tr><th></th><th>загрузка</th><th>осталось</th><th>всего</th></tr>
    <tr><td>время:</td><td id="elapsed">∞</td><td id="remaining">∞</td><td id="total">∞</td></tr>
    <tr><td>размер:</td><td id="sent">0 b</td><td id="offset">0 b</td><td id="length">0 b</td></tr>
    <tr><td>скорость:</td><td id="speed">n/a</td></tr>
  </table>
  <div style="border: 1px solid #c0c0c0;">
    <div style="background: #c0c0c0; width: 0%; text-align: right;" id="bar">0%</div>
  </div>
  <a href="#" onclick="if (confirm('Вы точно хотите отменить загрузку?')) window.location = '/'" id="cancel">cancel_upload();</a>
</div>
</body>
</html>

ANSWER: http://code.google.com/p/chromium/issues/detail?id=45196

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T21:15:55+00:00Added an answer on June 8, 2026 at 9:15 pm

    Apparently there is so bug with chrome.
    http://code.google.com/p/chromium/issues/detail?id=45196

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this sounds kind of vague, but please let me explain- I'm starting
I know this may sound silly little bit, but there is no other way
I know this sounds kind of stupid, but as a beginner in Django (and
I know that the reminder application should display a badge or sound or kind
I know this is kind of a dumb question, but does anyone have an
I know that this kind of issue is most discussed. But I would like
I know this might sound silly but I have no idea how to do
I know this sounds strange, mixing CDI (Weld) and Spring for the controller. But
It may sound silly, but I would need to identify which kind of SQL
I know this sounds a little ridiculous, but I'm just honestly wondering how I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.