On Tue, Sep 16, 2008 at 4:39 PM, Werner Thie <[EMAIL PROTECTED]>wrote:
> There are some post revolving around onbeforeunload/IE7 and a quick
> debugging session shows that no code is ever executed for onbeforeunload
> with IE.
>
>
>>
> I came up with the following some months ago. Since then, we're not seeing
the problem on IE6 or 7. Would be interested in hearing whether it works for
you. (Would have entered it as a Divmod ticket, but can't seem to find a way
to create one, nor to create an account...)
Harald
------------------------------------------------------------------------------------------------------------------------
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.
_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web