On Wed, May 7, 2008 at 12:49 PM, Tristan Seligmann <mithrandi@mithrandi.net> wrote:
* Harald Blåtand <kozneb@gmail.com> [2008-05-07 12:24:18 +0200]:

> Just thought that since we have IE all over the place, and we can't have an
> app that freezes if a user refreshes it, I might make a feeble attempt... By

Indeed, I'm in the same position with my own application: our userbase
is currently 100% IE-using, with the exception of us developers ;)
 
I may have something now that keeps IE from hanging on a page refresh.
Here's what I've changed in the 0.9.31 JS code:
 
------------------ Nevow/Athena/__init__.js (2 additions) --------------------------
Nevow.Athena.Widget._initialize = function() {
    Divmod.debug("widget", "Instantiating live widgets");
    Nevow.Athena.Widget._pageLoaded = true;
    // With the next line, sendCloseMessage will get called in IE. // Harald
    Divmod.Base.addUnLoadEvent(Nevow.Athena.page.deliveryChannel); // Harald
    Nevow.Athena.Widget._instantiateWidgets();
    Divmod.debug("widget", "Finished instantiating live widgets");
};
Nevow.Athena.bootstrap = function (pageClassName, clientID) {
    var self = this;
    var pageClass = Divmod.namedAny(pageClassName);
    self.page = pageClass(clientID, Nevow.Athena._createMessageDelivery);
    Nevow.Athena.page = self.page;                                // Harald
    self.page.bindEvents(window);
    .....
 
------------------ Divmod/Base.js (1 added function at the end) --------------------------
Divmod.Base.addUnLoadEvent = function(channel) {
    /***
        Harald's desperate try to get IE page refresh to work...
    ***/
    window.attachEvent("onunload", function (e) {channel.sendCloseMessage();});
};
Divmod.Base.jsonRegistry = Divmod.Base.AdapterRegistry();
I'm not used to this coding style, so it's a bit of trial & error. Anyway, before, sendCloseMessage would _not_ be called; now it is, and I can refresh ad lib on IE 6.and 7.
 
Not sure either what this will do to FF. (Since we're stuck with IE, I'm heavily abusing its non-standard extras, so I can't get my full app to run on FF.) Besides, you're better on FF than I am :-)
 
Finally, to fix the onkeypress issue, I think we'd need to go deeper into the "this" dept. For me, the refresh is more important - if the users insist on pressing ESC, they can blame themselves.. ;-)
 
What do you think?
 
Regards,
Harald