What else is burried down in the depth’s of Google’s amazing JavaScript?

So the new GTalk interface in GMail is pretty rad. Congrats to Dan and the rest of the team that made it “go”.

The talk feature is cool not just from a UI perspective as the code is also chock full of little gems. I’m kind of a dork about low-latency data transport to the browser. HTTP wasn’t meant to be used this way…so of course I’m interested! Ever since Joyce got me involved in the rewrite of mod_pubsub I’ve had my eye on the various ways that servers can push data to browsers and the kinds of technology that will prevent a server that’s doing this from melting down (hellooooooooo Twisted). Using just what’s available to the browser, it’s possible to have the server push data encapsulated in <script> blocks and rely on a progressive rendering behavior that every modern browser implements to dispatch events in near real-time (compared to full page refresh or polling delay). There are a mountain of browser quirks that of course play into this process. The least desirable of these to the user are the “phantom click” and the “throbber of doom” that afflict IE users.

When a page (or an iframe it hosts) is loading content, your browser usually shows some sort of “I’m working” indicator. In the bottom “taskbar” there is usually some sort of progress meter. In the upper right (on IE) the “throbber” will continue to animate until the work is done. Of course in the scenario I’m describing the sent page is never done. The whole point is that the server keeps the connection open. Combine this with the IE behavior of producing a “click” like sound when an iframe is navigated to a different URL, and you’ve got a pretty poor user experience.

But couldn’t you do something with XMLHTTP? Short answer: yes, but not as portably and it won’t get you around IE’s 2-connection limit either so there’s not much of a win. For the long answer, see my talk at ETech or wait for me to post the slides. At the end of the day, the hidden <iframe> hack scales best and is the most portable. Especially if you can lick the UX problems.

Which Google has.

How? By cleverly abusing another safe-for-scripting ActiveX control in IE. Here’s the basic structure of the hack:

  // we were served from child.example.com but 
  // have already set document.domain to example.com
  var currentDomain = "http://exmaple.com/"; 
  var dataStreamUrl = currentDomain+"path/to/server.cgi";
  var transferDoc = new ActiveXObject("htmlfile"); // !?!
  // make sure it's really scriptable
  // set the iframe up to call the server for data
  var ifrDiv = transferDoc.createElement("div");
  // start communicating
  ifrDiv.innerHTML = "<iframe src='"+dataStreamUrl+"'></iframe>";

This is the kind of fundamental technique that is critical to making the next generation of interactive experiences a reality. Server tools like mod_pubsub and LivePage (and perhaps even JMS buses) are starting to come into their own and the benefits of event-driven IO are starting to become well understood by server-side devs. It’s only a matter of time before server-push data hits an inflection point in the same way that background single-request/single-response data transfer did with Ajax. Dojo will, of course, have infrastructure to support this kind of thing when the borader developer community is ready (most if it is already in place).

From long and painful experience and amazingly deep respect, I take my hat off and bow to whoever it was on the GMail/GTalk team that figured this out. It’s a hell of a hack. It’s no wonder that Google has been able to attract and develop the best DHTML hackers in the world.

Update: so just to be *very* clear, I worked on the rewrite of the mod_pubsub *client*. The server rewrite was handled by some folks who are much smarter than I am.


  1. robert
    Posted February 13, 2006 at 2:17 am | Permalink

    So, how does this work in Firefox then? Another technique?

  2. Posted February 13, 2006 at 2:27 am | Permalink

    On FF (1.5), the communication iframe only makes the statusbar say “Transfering data from example.com…” while the throbber stops when a subsequent HTTP request has finished. It’s much less distracting. While not perfect, it sure beats having the top thinger spinning, and a solution for the 85%+ browser is *much* more important for the acceptance of the technique.

  3. Posted February 13, 2006 at 2:31 am | Permalink

    Is the htmlfile object documented anywhere? I can’t find it on MSDN (but then I can never find anything on MSDN).

  4. Posted February 13, 2006 at 3:01 am | Permalink

    Not sure. I think the above syntax gives you a document that implements IHTMLDocument2:



  5. Posted February 13, 2006 at 3:32 am | Permalink

    How’s the rewrite of mod_pubsub going?

  6. Posted February 13, 2006 at 3:35 am | Permalink

    It’s done but not yet released as Open Source software. You might ping Joyce to see what the current price for a copy is.

  7. Sjors Pals
    Posted February 13, 2006 at 3:54 am | Permalink

    Nice, but this is still a “hack”, the problem is that HTML is just not suitable for RIA’s. I believe that “ajax” can be used for small parts of a website, but its totally not suitable for complete webbased applications with rich interaction. One of the worst things about Ajax is that techniques are based on hacks, and not on standards. An other problem is that HTML is just not suitable for rich internet, example: if you need an accordion element, tree structure, or tab interface, you have to build it still in HTML. While in flash its just adding 1 tag and its completely rendered on the client.

  8. Posted February 13, 2006 at 4:03 am | Permalink


    Of course it’s a hack. Welcome to the web. This is how real work gets done out here in the world of universal deployment.

    As for Flash and components, I invite you to check out the widgets we’re building in Dojo. They make building richer interfaces easier, to the extent that declaring rich components can be as little as a couple of tags. These components aren’t Flash, but that’s both a benefit and a liability.


  9. Posted February 13, 2006 at 6:25 am | Permalink

    Tables were hacks too, and look at how using them turned out. I have a feeling that we’re going to be repeating history with applications based on code like this.

  10. Posted February 13, 2006 at 10:12 am | Permalink

    Forgive the denseness, but how is this different from programatically or manually (via a click) changing the src of the iframe to a dynamic page and writing out the javascript data using some server side technology? (e.g. the “back in the old days” method) Or if you prefer, changing the location of a 0px w/h or hiddent frame?

  11. Posted February 13, 2006 at 11:18 am | Permalink


    It’s unique in several ways. It builds on the programmaticaly “moving” an iframe to a different URL, but with the cooperation of the server streams events down the wire without closing the connection. Furthermore, unlike hosting the iframe directly under the spawning document, this technique avoids the background “click” noise and prevents the throbber from spinning. It’s a usability enhancement to a well-known technique (at least in the small community of people that care about low-latency data to the browser).


  12. Posted February 13, 2006 at 11:47 am | Permalink

    Cheers Alex. The team are glad to know people are noticing the technical achievements of Gmail Chat. As you know, I joined the team quite late on and was equally impressed when I found out how they were handling the persistant connection, it’s a stroke of Genius.

  13. Posted February 13, 2006 at 11:47 am | Permalink

    (For the record I only played a small role in this launch)

  14. Posted February 13, 2006 at 1:59 pm | Permalink

    That’s pretty cute. Indeed, the call will return IHTMLDocument2. I wonder if this leaks any?

  15. lescoste
    Posted February 14, 2006 at 4:48 am | Permalink

    Hi, Nice job going thru the js code.
    But did you found how gmail talk detects when you are away ?

  16. Posted February 14, 2006 at 4:58 am | Permalink

    Thanks for the insight.

    It’s amazing how irritating that iframe click is on the sites that use that method.

  17. Hull
    Posted February 14, 2006 at 4:58 am | Permalink

    The problem I see is that common web hosts aren’t likely to be very happy, are they? As far as I can tell, using this technique with any common web host will tie up Apache workers, reducing the number of ‘ready to serve’ Apache workers, introducing various performance side effects, say from the number of requests going through per minute to how well you can withstand a slashdotting.

  18. Posted February 14, 2006 at 7:14 am | Permalink

    I think this is pretty cool, I just find the inconsistency that exist with AJAX implementation is a bit of a pain. Until the standard’s grow I just don’t see the movement of AJAX going any further, all we do is hack out some code for small little apps when developing the page using AJAX instead of using a standard built in method. Anyway’s this was a great read!

  19. Tim
    Posted February 14, 2006 at 8:05 am | Permalink

    What about the up and coming Windows Smart Client tools? I don’t know much about it but I had heard it will make the “Desktop over internet” experiance even more a reality. It sounds very promising.

  20. Posted February 14, 2006 at 9:33 am | Permalink

    A potential downside of this approach is the need to send the complete HTML to the client, while with XmlHttpRequest you could send a more efficient XML format and let JavaScript reformat the output. This means you have to deal with more ‘live’ data and bandwith usage. Of course, both approaches have their advantages and the ‘right tool for the job’ rule applies, but I’d like to mention this nevertheless…

  21. Posted February 14, 2006 at 9:48 am | Permalink

    Hull: this stuff won’t run on today’s Apache (hence the link to Tiwsted). The current worker setup is just too resource intensive for “zombie” connections.

    Tim: as I’ve said here before, you can develop richer interactions in whatever environment you like, but please don’t make any mistake that if it’s not HTML, CSS and JavaScript, it’s not the web.

    Filip: You’re not sending “the complete html”, you’re sending small datagrams encoded in a script tag envelope. The data on the wire is usually some sort of JSON data structure.

  22. Posted February 14, 2006 at 10:33 am | Permalink

    This isn’t really new, just got associated with the shiny buzzword AJAX now. The concept of an open pending http connection exactly what iTunes does when sharing between two computers. iTunes’ DAAP is really just a HTTP service between two clients. They keep an open HTTP request and if the server needs to tell the client something now it just sends a response back over that request.

  23. Posted February 14, 2006 at 10:34 am | Permalink

    I have been doing an AJAX like technology for several years now. Instead of using an ActiveX object, I simply define a number of script tags and then use javascript to assign them to send and retreive data from the server.

    function loadCustomer(McustId) { document.all.general1.src=”getCust.php?”+McustId

    The php returns executable javascript, which obviously works like regular javascript. Instead of using XML, I format it so that it renders the data in the form needed for each specific case.

    The issue of PUSH is interesting to me. There are many times that I would like my local application to know about events. I use polling currently. I have thought about using Flash, which has notification capabilities. Really, all that is needed is to say “Hey, its time to check the server.”

    I am unclear about the server aspect of this particular approach (Tiwsted)

  24. Tree
    Posted February 14, 2006 at 3:13 pm | Permalink

    multipart http content type is what you are looking for. Netscape already has invented that back in the 90’s.

    They were just too far ahead of their time. Web weren’t mature enough to use it. Here is a link on how you can implement “Serverside-Push” web application. Combine with iframe and XMLHTTPRequest Object (AKA Ajax) you can build a realtime application. Althougth according to how most server side scripting language (PHP, Perl, Python and Ruby)are integrated into the web server (each process doesn’t know about other process), they are not suitable for such task.

  25. Posted February 14, 2006 at 3:17 pm | Permalink


    Multipart is *not* what we’re looking for. We need something portable, and multipart isn’t it. While I would personally prefer it if Opera, Safari, and IE would agree on a multipart boundary and encoding syntax, it hasn’t happened. Until then, the iframe hack is the lowest latency option.


  26. Posted February 14, 2006 at 9:16 pm | Permalink

    I just started playing around with this, but it’s got me stumped: I’ve added an onload event to the iframe, but I don’t expect that to give me anything useful. Do I simply continuously check to see if the iframe’s innerHTML has changed?

  27. Posted February 14, 2006 at 9:55 pm | Permalink

    This is not new technology. It has been around for at least 6 years. The guy who invented it works for Oracle, and so Oracle now owns the patent on it.

    I came to Oracle when it acquired PeopleSoft, which acquired a startup I was the architect for called istante software.

    We use this technology in Oracle BAM to keep our business activity monitoring dashboard up to date in real time. In fact we guarantee that the time elapsed between our backend server getting a transaction committed and the time it shows up in all of the dashboard that are affected is not more than 2-5 behinds real time.

    We use 1 connecion for all of the dashboard a use has on his desktop, and we “multiplex” the ActiveData through that connection (which is one of our pending patents).

    We send down XML documents that only have the change each view needs to get, and not complete HTML like someone was suggesting here…

    Using Oracle BAM users can build real time dashboards and alerts on any data model they define, and doing all of that happens also in 100% thin and rich web based applications (which are also using Ajax when it makes sense).

    The first version n our product with all of what I mentioned shipped in 2003.

  28. Posted February 14, 2006 at 11:35 pm | Permalink

    Hi Tal,

    I never claimed that the technique of streaming data down the wire was new. When I re-wrote the client for the Open Source’d version of mod_pubsub several years ago, the technique was old then. We even re-implemented the hack that allowed multiple browser windows to use the same connection (think IPC over cookies).

    What I *did* claim is that Google’s improvement on it with respect to IE *is* novel and that it removes a significant usability barrier. If Oracle implemented this particular browser-specific workaround, that would be good to know so credit can be given where it’s due.

    As for patents and timing, I suggest you contact KnowNow whose business started around this technique (I believe) prior to the date you mention. There is likely not only prior art, there is prior art for the multiplexing portion and all of the client techniques.

    I recommend that you do your homework on this one before claiming that your company has been wronged, that anyone is in breach of patent, or that I have stated something inaccurate. Well-informed corrections are welcome, however.


  29. Posted February 14, 2006 at 11:38 pm | Permalink

    Peter: what I blogged is only the smallest portion of the overall technique for streaming data to the client over HTTP. An onload event won’t get you where you want to go. The script tags sent down the wire themselves need to call the dispatchEvent() method (or whatever your version will call it).

  30. Posted February 15, 2006 at 5:41 am | Permalink

    Oops, I misread the article. I concluded that the data going through is the final product: HTML. Of course, HTML is less compact then XML, so that would mean more bandwidth. Obviously, I was wrong because the format doesn’t have to be HTML.

    This approach actually seems to be quite a viable alternative to XmlHttpRequest in some cases, so I’m definitely going to check it out and learn more about it. Thanks for mentioning it :)

  31. Posted February 15, 2006 at 12:50 pm | Permalink

    Isn’t this technique an updated form of “Pushlets?”

    Pushlets: Send events from servlets to DHTML client browsers

    Discover how pushlets, a servlet-based notification mechanism, enables server-side Java objects to call back JavaScript code within a client browser.

  32. Posted February 15, 2006 at 1:06 pm | Permalink


    It has gone by many names over the years. Pushlets was just one. IIRC, however, it scaled like a lead brick. Newer event-driven server environments that eschew Servelets and Threads in favor of CPS (Twisted and POE) or a single “keepalive dispatcher” (Apache Event MPM) allow the technique to finally scale well. Kernel level improvements like epoll and kqueue (wrapped in libevent) have accelerated this.

    As for how it looks on the wire and what the client strategy is, there are many ways to skin this cat. I’m only covering a single improvement by Google to one of the better-performing approaches.


  33. james
    Posted February 15, 2006 at 3:43 pm | Permalink

    yawn, cgiirc works (has worked) on all modern browsers using an open connection to the web server. this isn’t new.

  34. Posted February 15, 2006 at 3:47 pm | Permalink

    James: you clearly didn’t read this. I didn’t claim that the technique of streaming data to the client was new. I claimed that Google’s variant on it that solves significant usability issues *is* novel.

  35. Posted February 15, 2006 at 6:55 pm | Permalink

    A super-hidden IFrame, fair enough. Does this work around the 2 max connections limit that exists in both browsers, though?

    If not, has _anyone_ come up with a clever workaround for the 2 connections limit, other than changing the registry for IE and prefs.js for Firefox (which can have other undesirable side effects)?

  36. Posted February 15, 2006 at 8:54 pm | Permalink


    I never claimed that our company has been wronged, or that anyone is in breach of patent.

    We have checked prior art (including KnowNow) before we submitted the patent applications.

    I agree think that Google’s use of this technology is awesome, and I think that what we do with it in Oracle BAM is not less cool :)


  37. Posted February 15, 2006 at 8:55 pm | Permalink

    check out our website (soon we will have some live demos on it): http://www.oracle.com/technology/products/integration/bam/index.html


  38. Posted February 17, 2006 at 3:25 am | Permalink

    Hey Alex,

    dont know if this is all obvious to you guys, but it took me some time to figure out:
    in order to access a function “outside” the htmlfile ActiveX Object you’ll have to set a reference under the “parentWindow” property of the ActiveX Object.

    function foo() {…}
    transferDoc = new ActiveXObject(“htmlfile”);
    transferDoc.parentWindow.foo = foo;

    // inside the iframe

    gmail does it the same way, so i guess there is no better solution ;)
    in order to avoid the “browser keeps loading” syndrom on Mozilla gmail uses the XMLHttpRequest which supports, at least under Mozilla, the readyState “INTERACTIVE”. It allows access to the responseText while its still loading. Unfortunatelly there is no way to clear the responseText, so everytime the readyState occurs you’ll have to substr out the stream data that you received before in order to get the newly received data. So it might be a good idea to reestablish the stream connection at some stage so the browser may free that memory. Certainly, this also applies to the iframe technique. (again, gmail does that aswell)

    greets from germany,


  39. Posted February 17, 2006 at 3:30 am | Permalink

    oops, i didnt know that a tripple dash does some formating stuff. would you please correct that and delete this post here?



  40. Rui Pinheiro
    Posted March 13, 2006 at 2:28 pm | Permalink

    Amazing stuff. I wonder about the possibility of doing the reverse, i.e., making the file upload process much smarter.

    Imagine resume, upload in blocks, etc. Besides being useful in a P2P-like situation, would be great where clients have to upload LARGE files to the server.

    I know, I’m a dreamer ;)

  41. Willem Mulder
    Posted March 25, 2006 at 9:28 am | Permalink

    So… Why does Google nog use this to check if there’s new mail… For as much as I know, there’s still a click on the ‘inbox’ link required to find out if there’s new mail… (or maybe it does check, but not often enough?)

  42. Jon
    Posted March 29, 2006 at 9:05 pm | Permalink

    Sorry to join the conversation so late; you wrote waaay back at the start of all this:

    “On FF (1.5), the communication iframe only makes the statusbar say “Transfering data from example.com…? while the throbber stops when a subsequent HTTP request has finished.”

    I’ve been having a very hard time reproducing that result, and I wonder if you could clarify a bit. Is it any old HTTP request on the page (i.e. an image or something), or does something fancy need to be done to make the spinner stop for Firefox?

    Thanks very much!

  43. Jon
    Posted April 1, 2006 at 8:42 pm | Permalink

    Something fancy DOES need to happen. I’ve managed to reproduce it, but I’m not entirely sure where the magic is…

  44. Posted April 8, 2006 at 11:20 am | Permalink

    Has anyone experimented with this “htmlfile” object to try multiple synchronous ajax requests? Seems like you could just use this instead of XMLHttpRequest.

  45. Nutz
    Posted May 6, 2006 at 11:17 am | Permalink

    Can someone (Alex?) post a working code example so we can see this Comet stuff in action ?

    Would/could it work with Microsoft IIS ?


  46. Gordon
    Posted June 9, 2006 at 4:22 pm | Permalink

    Maybe this is a stupid question, but I’m wondering one more thing. When a user (let’s call them the sender) clicks on another user’s name (the receiver) to chat, the sender opens up a small iframe window to chat and all this code does its magic. But how does the receiver’s window know to likewise open an iframe?

    My best guess is that as soon as anyone logs into Gmail, a persistent connection is established and is constantly left open, even when no one is chatting. Do you know if this is the case?

  47. Posted June 9, 2006 at 7:42 pm | Permalink

    This rules! I’m in the process of releasing an IFRAME based AJAX implementation that is able to get around the browser “same origin” policy (http://en.wikipedia.org/wiki/Same_origin_policy). I thought I was pretty hot stuff… until I turned off the mute button on my computer…. click, click, click, click….. ARRRRG!

    However, using this ActiveXObject(“htmlfile”) solved my woes! No more clicks or annoying visual queues in IE! I need to stick with the “single-request” method rather than going for a persistent connection b/c it’s fundamental to the way I’m able to skirt same origin (except for Opera which is known to be overly sensitive with iframe security).

    Since this appears to be a well versed community, out of curiosity does anyone else here have asynchronous communcations working outside of the same origin? Would be nice to know if my architecture is as unique as I think it is, or if I simply reinvented the wheel ;)


  48. Scott
    Posted June 28, 2006 at 9:18 am | Permalink

    Hi Alex,

    I am very interested in using DOJO for a new website. We require realtime push, just like the google dynamic iframe solution provides. Do you have any idea when this would be implemented in DOJO?


  49. Posted July 23, 2006 at 6:17 am | Permalink

    Thanks Andrew,

    I remembered having seen this technique at work, but could not recall it was Pushlets :)

    Would it be correct to say that the client side is exactly same as Pushlets while the server side is implemented differently…or I am missing something here ? As you said, I am also curious about what other names it has gone by !

    Warm regards,

  50. Posted August 16, 2006 at 12:30 am | Permalink

    That was an awesome article, still have to go through all the other links that are present.

    But all these “hacks” against the browser shouldn’t go unnoticed. These new Applications, are changing the way we browse the web.

    Soon I hope browsers should come up with the “Back” button for the “Last Ajax based event”. I don’t know how are devs @ Mozilla working towards it, probably Firefox 3.

  51. Posted August 24, 2006 at 10:51 am | Permalink

    Hi you all,

    i tried the code on ie5.5 on win98 and end up with:
    function rpc_iframe()


    var currentDomain = “localhost/?;

    var dataStreamUrl = currentDomain+?rpc-test/server.php?;

    var transferDoc = new ActiveXObject(?htmlfile?); // neue Seite






    var ifrDiv = transferDoc.createElement(?div?);


    ifrDiv.innerHTML = “?;


    Everything went fine… except the window wont close.

    Any ideas to manage it?
    Thanks in advance


  52. Affonso Loyola
    Posted September 5, 2006 at 9:01 am | Permalink

    So. How do we retrieve the content from the iframe?
    I’m trying some remote scripting calling “window.parent.callback” but
    it seems that the iframe doesn’t have any reference to the “outter” document.
    So anyone knows how does it work?

  53. Affonso Loyola
    Posted September 5, 2006 at 9:43 am | Permalink

    I’ve tryed what Martin Franz decribed, setting the:
    transferDoc.parentWindow.foo = foo;
    But I cant make it work!
    Someone successfull on that?

  54. Affonso Loyola
    Posted September 5, 2006 at 10:52 am | Permalink

    I think iI might not setting the domain rigth on the outter document and
    in the iframe. I’m sunning my application on localhost. Is that a problem?

  55. Posted September 14, 2006 at 6:59 pm | Permalink

    so,if the iframe is appened to the htmlfile activex object,
    how does the iframe frame’s javascript code call its parent frame’s functions? 
    just like the code “parent.transData(‘test’)” in the iframe.

  56. Posted September 15, 2006 at 8:01 pm | Permalink

    transferDoc.parentWindow.foo = foo;
    It works well,
    but I discover another fatal problem,the “htmlfile” activexobject will timeout after about 30s autolly,And the iframe doesn’t output anything.

  57. Bench
    Posted September 24, 2006 at 10:48 am | Permalink

    Interesting, but how do you call functions IN the window that opens the transferDoc FROM the iframe inside the transferDoc ?

    I see no logic with this at all:

    transferDoc.parentWindow.foo = foo;

  58. Bench
    Posted September 24, 2006 at 4:06 pm | Permalink

    incidentally, what would be the equivalent to this:

    var transferDoc = new ActiveXObject(“htmlfile”); // !?!

    for Firefox?

  59. Posted November 14, 2006 at 2:20 am | Permalink

     I don’t think there’s something equivalent for firefox…

  60. rick
    Posted December 1, 2006 at 4:15 am | Permalink

    Is here anybody who have found out the solution in firefox?

  61. Posted December 1, 2006 at 4:19 am | Permalink


  62. Ivan Garavito
    Posted December 19, 2006 at 11:02 am | Permalink

    Hi Alex,

    It seems that lots of them can’t try something new (to them). I’ve been tracking some of the Dojo Toolkit. It’s really amazing and interisting, but currently I understand that dojo uses Ajax to interact with the server. Do you, the Dojo’s development team, plan to adopt, port or migrate to “Comet” model? I know Dojo has the Cometd project, but is this a separated project? or will be integrated into dojo’s javascript libraries? If so, which version will include it?

    Ivan Garavito

  63. Posted January 13, 2007 at 5:15 am | Permalink

    Is this the same as the oracle htmlfile object?

  64. Dok
    Posted March 2, 2007 at 12:08 pm | Permalink

    In Firefox you don’t need to mess with frames as the XmlHttpRequest will return data as it’s being loaded and there is no “throbbing” problem.

    For IE, has anyone confirmed that you can call code in the parent of the “htmlfile” frame?

    Alex, you have comments in the cometd.js code to the effect of “TODO: improve with Gmail fix”. Any luck?

    The IE iframe issue being solved, how does gmail get around the 2-connections limit?
    What are the possible approaches for that as it’s a common problem in FF and IE?

    The obvious is to change the browser behavior. Good luck with that! We need solutions that work now.

  65. Aaron
    Posted March 3, 2007 at 5:17 pm | Permalink

    This is quite neat, ajax is pretty neat I just wish they would make it simpler, or turn it into a standard so that instead of opening a big xmlhttp request just have like a line or two of code that could send data and recieve data, or have an option to keep an open connection.

    Be kinda cool to see if they make web pages in the future be run off of ajax or something similiar so browsers never have to refresh.


  66. Jason
    Posted September 10, 2007 at 12:21 pm | Permalink

    See this link for info on how to do this in Firefox/Mozilla:http://meteorserver.org/browser-techniques/

  67. Matthew
    Posted September 4, 2009 at 8:19 pm | Permalink

    I’ve been searching around for this thing called “Comet” or “HTTP streaming” for the past hour or so, and now I find out it’s just a lame hack. Why doesn’t someone just give JavaScript a socket object, and then we can just do things in a more straightforward way that makes sense? Geez. Do I have to take the overhead of Java or Flash every time I want to open a normal socket connection?

16 Trackbacks

  1. […] read more | digg story […]

  2. By Lazycoder » A few quick links on February 13, 2006 at 11:53 am

    […] What else is burried down in the depth’s of Google’s amazing Javascript? – At first I was confused. It looks just like the old hidden frame/iframe technique. But, Alex revealed the difference in the comments. […]

  3. […] Continuing Intermittent Incoherency » What else is burried down in the depth’s of Google’s amazing JavaScript? […]

  4. By » The Next Ajax? « marksdigital on February 14, 2006 at 7:06 am

    […] read more | digg story […]

  5. […] Using just what’s available to the browser, it’s possible to have the server push data encapsulated in blocks and rely on a progressive rendering behavior that every modern browser implements to dispatch events in near real-time (compared to full page refresh or polling delay).read more | digg story […]

  6. […] Continuing Intermittent Incoherency » What else is burried down in the depth’s of Google’s amazing JavaScript? (tags: javascript ajax communication) […]

  7. […] Using just whatâ��s available to the browser, itâ��s possible to have the server push data encapsulated in blocks and rely on a progressive rendering behavior that every modern browser implements to dispatch events in near real-time (compared to full page refresh or polling delay).read more | digg story   […]

  8. By Bohr’s Blog » links for 2006-02-13 on February 17, 2006 at 1:18 pm

    […] What else is burried down in the depth’s of Google’s amazing JavaScript? […]

  9. […] As it turns out, there is but it requires some hacking. Google has been leading this effort – they recently integrated their Google Talk service with Gmail and so now it requires more resources. Instead of polling the mail server every 5 minutes for new mail, you need to poll the chat server every 3-5 seconds. So they discovered how to use the PUSH model in modern browsers. Incredible. […]

  10. […] Continuing Intermittent Incoherency » What else is burried down in the depth’s of Google’s amazing JavaScript? :: Google lo hizo de nuevo: Ha integrado Talk dentro de GMail explotando funcionalidades de la web que siempre estuvieron ahí. Funciona muy bien. […]

  11. […] However, this method has a significant downside: while the document is loading in the iframe, on IE the logo on the top right of the window keeps spinning. This gives a wrong impression to the user. The clever people at Google found a solution to this IE-specific problem: instead of using an invisible iframe directly in the page, they create an instance of the “htmlfile” ActiveX object, and create the iframe in that object. Alex Russell discovered this clever hack in the Gmail code, and I totally agree with him on this: From long and painful experience and amazingly deep respect, I take my hat off and bow to whoever it was on the GMail/GTalk team that figured this out. It’s a hell of a hack. It’s no wonder that Google has been able to attract and develop the best DHTML hackers in the world. […]

  12. […] What else is burried down in the depth’s of Google’s amazing JavaScript? Gmail talk ?使用的?? connection 的秘技 […]

  13. […] As with Ajax, those of us who build technology are now faced with another communication challenge. We have a hard problem for which solutions are available (and have been for some time) but no way to communicate about them. Terminology is again the missing link. Today, keeping an HTTP connection open for doing low-latency data transfer to the browser has no digestible name. When I describe a cool new hack, there’s nothing to associate it with. When people say “how the hell did they do that?”, we don’t have a compact answer. Therefore, in the spirit of improved communication (and not technology invention), I’m proposing a new name for this stuff. […]

  14. […] In early 2006, Alex Russell posted about a neat hack that the Google Talk team in Gmail use to support Comet in Internet Explorer, a trick which works as far back as IE 5.01. What great news! A reliable way to stream Comet messages to Microsoft’s browsers. If only it were that easy. […]

  15. By Antivirus free downloads on December 29, 2007 at 3:32 pm

    AVG free

  16. By Comet Daily » Blog Archive » Canonical Comet Apps on January 24, 2008 at 1:25 pm

    […] Shortly after Google launched Google Talk, they added chat to the Gmail interface, providing low-latency IM to all Gmail users. Alex Russell quickly dissected their implementation and learned that Google uses the forever-frame technique. Michael Carter made progress on understanding the htmlfile hack for Internet Explorer. […]