in reply to Streaming JS commands to IE with a Perl HTTP push server

I'm not sure that IE allows the "inline" javascript to fire reliably before the full DOM is constructed.

Have you tried using the '100 Continue' header? (eg: using the same socket to send multiple HTTP responses).

IIUC conforming HTTP/1.1 client implementations will implement this just fine.

-David

  • Comment on Re: Streaming JS commands to IE with a Perl HTTP push server

Replies are listed 'Best First'.
Re^2: Streaming JS commands to IE with a Perl HTTP push server
by freefall (Initiate) on Aug 11, 2007 at 03:18 UTC
    Well I think you got me going on a good track of checking different HTTP headers and re-examining the example at http://empireenterprises.com/_comet.html

    Unfortunately I still have no luck with IE with different headers, meta tags, regular tags, etc. I re-examined the example and saw that he's not printing javascript functions at all, but rather just JSON objects. JSON is useless unless it is evaluated, so I think that he is somehow actually accessing the innerHTML during page load in IE (unfortunately have not been able to contact him). His client code obviously does this but I have no idea how the server gets IE to work (I even tried the exact same headers and tags).

    I tried a new test to see if the script may be executing but not interacting by setting a variable to the current Javascript time in each step, waiting two seconds, then setting again. The last time I used an alert() to print the values. Firefox - three different times, IE - same time.

    The other major working example is here: http://meteorserver.org/

    The code is much more complicated, but they also created a Perl server. I am not able to pick it apart enough to tell what is wrong with mine. Ugh - I thought for sure something would give me hope today.
      For anyone interested in this post, I discovered the solution to the problem. Before Internet Explorer will start streaming Javascript commands or any content, it must receive 256 bytes of data. This is as simple as
      print $sock ' ' x 256;
      What a ridiculous solution. I found this in the last sentence of the PHP manual entry for "flush".