I can get the code below to work on all other browsers but in both
chrome and safari (both WebKit based) I get the onrequest() event
firing but nothing else - This happens both on windows and OS X. I
have tried debugging with the console and using Fiddler2 but with no
joy - from fiddler it looks like the request is never actually made.
There is a basic example at http://app2.frozenskys.com that this code
is taken from.


Thanks in Advance
Richard.


<script type="text/javascript" charset="utf-8">
    var uuid = ""

    for (i = 0; i < 32; i++) {
        uuid += Math.floor(Math.random() * 16).toString(16);
    }

    var req = new Request({
        method: 'get',
        headers: {'X-Progress-ID': uuid},
        url: 'http://app2.frozenskys.com/upload/progress/',
        initialDelay: 500,
        delay: 1000,
        limit: 10000,
        onSuccess: function(reply) {
            console.debug("Got a reply");
            test = JSON.decode(reply);
            console.dir(test);
            console.debug(test.state);
            switch(test.state) {
                    case "uploading":
                        percent = 0.00 + parseFloat(Math.floor
((test.received / test.size)*1000)/10);
                        console.debug("Uploading : %s", percent);
                        break;
                    case "starting":
                        console.debug("Starting...");
                        break;
                    case "error":
                        console.debug("Error : %s", test.status);
                        console.warning("Error : %s", test.status );
                        break;
                    case "done":
                        console.debug("Done...");
                        req.stopTimer();
                        break;
                    default:
                        console.debug("Oooops!");
                        break;
            }
        },
        onRequest: function(){
            console.debug("Request Started");
        },
        onComplete: function(){
            console.debug("Request Complete");
        },
        onException: function(header,value){
            console.debug("Exception setting : %s", header);
            console.dir(header);
            console.dir(value);
        },
        onFailure: function(xhr){
            console.debug("Failure : %s", xhr);
            console.dir(xhr);
        }
    })

    $('submit').addEvent( 'click', function(evt){
        console.debug("StartProgressBarRequests");
        filename = $("id_file").get('value').split(/[\/\\]/).pop();
        document.getElementById("upload_form").action="/upload/?X-
Progress-ID=" + uuid
        req.startTimer('X-Progress-ID=' + uuid);
     });

</script>

Reply via email to