Home > front end >  Google progress bar can not complete show great god advice please
Google progress bar can not complete show great god advice please

Time:09-30

Small white one, according to the Internet to find the code of the progress bar shows the WebSocket, backend DJANGO, currently use IE browser can display a normal schedule, but Google show progress bar can't complete, always in the last two data will be over, for example, Google will only show the progress bar is 100% to 98% or 99%, if it is only show from 50% to 48% or 49%, but the back-end is already 100% push the data, the console is
"The WebSocket connection to 'ws://192.168.0.123:8000/prog' failed: Invalid frame header"

Internet explorer and firefox, everything is normal,
Please comment that how to deal with, thank you for the great spirit show


The HTML
 & lt; head> 
Django - websocket
<script SRC="http://code.jquery.com/jquery-1.11.1.min.js" & gt; </script>

<script SRC="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" & gt; </script>
<script SRC="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js" & gt; </script>



<body>






0%












Style="width: 60%;">













JS code

 
The/var/ws.
$(
The function () {
//the debugger;
//ws=new WebSocket (" ws://"+ window. The location, the hostname +" : "+ window. The location, the port +"/plmimport/Home/WSChat? Userid="+ $(' # userid). Val ());

$(' # connect_websocket). Click (function () {
If (window. S) {
Window. S.c lose ()
}
Var ws=new WebSocket (ws://192.168.0.123:8000/"prog");
Ws. Onopen=function () {
The console. The log (" Connected!" );
};
Ws. Onmessage=function (e) {
The console. The log (' the message: '+ e.d ata);
$(' progress bar '). The CSS (' width ', e.d ata + '%');
$(' progress bar - '). The text (e.d ata + '%');
};
$(' # close_websocket). Click (function () {
If (window. S) {
Window. S.c lose ();//close the websocket
The console. The log (' websocket closed);
}
});

});


}
);
</script>


  • Related