An interesting suggestion - but Firefox is the only browser that supports
onpageshow. Perhaps this is a legitimate case for using IE's conditional
comments?
There use to be a bug in Firefox where if you didn't
unbind the mouse listeners on unload it would cause exceptions when
the page was reloaded. However I'm having a hard time reproducing it
now in Firefox 3.0+ so it seems like this can be legitimately removed.

I'm open to other suggestions besides conditional comments, of course.

--John


On Wed, Jul 29, 2009 at 6:33 AM, James Padolsey <
jamespadol...@googlemail.com> wrote:

>
> Good idea Mark!
>
> This seems to work:
>
> jQuery.support.bfCache = (function(){
>    document.body.setAttribute('onpageshow', 'return;');
>    return typeof window.onpageshow === 'function';
> })();
>
> Event detection technique from
>
> http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
>
> On 29 July, 11:14, Mark Gibson <jollyt...@gmail.com> wrote:
> > Maybe you could approach this from the other side,
> > ie. don't add the "unload" handler if bfcache is available.
> > You could probably use the pageshow or pagehide events to detect this.
> >
> > -- Mark
> >
> > 2009/7/29 James Padolsey <jamespadol...@googlemail.com>:
> >
> >
> >
> > > Around line ~3100 (3321 in the latest nightly) you're binding the
> > > unload event so as to prevent any memory leaks in our favourite
> > > browser (IE). Unfortunately the presence of an "unload" handler
> > > disables some caching techniques used in other browsers (see
> > >https://developer.mozilla.org/En/Using_Firefox_1.5_caching...
> > > Specifically the "bfcache").
> >
> > > I know you're no longer using browser detection so I was wondering, is
> > > there an easy and quick way to detect a browser that's going to leak
> > > memory? ... If so, you could conditionally add the "unload" handler,
> > > only for browsers that require it (IE)...
> >
> > > If there's no way of testing it then why can't you just use some
> > > browser detection there? Is the cost of disabling the bfcache really
> > > worth the benefit of having no browser detection in the core?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to