Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Dec 2009
    Location
    Pretoria,Gauteng,South Africa
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am implementing a 3270 terminal emulator with a special web server and the rendering of the screen in a web browser. The screen layout is contained in XML data which is retrieved by the XMLHttpRequest object. There is always an XMLHttpRequest in effect until data arrives from the mainframe via the server. This data may be unsolicited. When data must be sent to the mainframe via the server, the XMLHttpRequest is canceled by either the browser or the server depending on the browser used. A new request is then issued.

    Here is the problem I have: In both IE8 and FF3 this mechanism is working fine, but in Chrome the subsequent request is simply not sent to the server. Calling the abort() member of the previously canceled request before making a new request does not help. Any help will be appreciated.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by Gerrit van Niekerk View Post
    In both IE8 and FF3 this mechanism is working fine, but in Chrome the subsequent request is simply not sent to the server. Calling the abort() member of the previously canceled request before making a new request does not help. Any help will be appreciated.
    Does your code set any conditions on issuing the subsequent request? Just wondering whether you're checking for some value that differs after abort() in different browsers.

  3. #3
    New Lounger
    Join Date
    Dec 2009
    Location
    Pretoria,Gauteng,South Africa
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jscher2000 View Post
    Does your code set any conditions on issuing the subsequent request? Just wondering whether you're checking for some value that differs after abort() in different browsers.
    The subsequent request is actually a completely new request. Here is the code:
    Code:
    var xhttp=0;
    
    function XhRequest(name)
    {
     if (xhttp) {  // this code not required for IE/FF; unsuccessful attempt to get Chrome to work
      xhttp.abort();
      delete xhttp;
      xhttp=0;
     }
     if (window.XMLHttpRequest){
      xhttp=new XMLHttpRequest()
     }
     else{
      xhttp=new ActiveXObject("Microsoft.XMLHTTP")
     }
     xhttp.open("POST",name,true);
     xhttp.onreadystatechange=checkXHR;
     xhttp.send(session);
    }

  4. #4
    New Lounger
    Join Date
    Dec 2009
    Location
    Pretoria,Gauteng,South Africa
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Gerrit van Niekerk View Post
    The subsequent request is actually a completely new request. Here is the code:
    Code:
    var xhttp=0;
    
    function XhRequest(name)
    {
     if (xhttp) {  // this code not required for IE/FF; unsuccessful attempt to get Chrome to work
      xhttp.abort();
      delete xhttp;
      xhttp=0;
     }
     if (window.XMLHttpRequest){
      xhttp=new XMLHttpRequest()
     }
     else{
      xhttp=new ActiveXObject("Microsoft.XMLHTTP")
     }
     xhttp.open("POST",name,true);
     xhttp.onreadystatechange=checkXHR;
     xhttp.send(session);
    }
    I found a solution, but I'm not too happy with it; if not a bug, it is a serious shortcoming of Chrome.

    The subsequent request is initiated by setting a timeout in the onreadystatechange handler which will issue the next request after the timeout:
    Code:
    function checkXHR()
    {
     if (xhttp.readyState!=4)
       return;
     // read XML and build screen
     setTimeout("XhRequest('data3270.xml')",400);
    }
    With IE and FF I can use a timeout of 50 ms, with Chrome it needs to be 400 ms.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •