Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

working bfcache example?

595 views
Skip to first unread message

Brad Kent

unread,
Dec 12, 2011, 10:39:49 AM12/12/11
to
I have a basic question regarding Firefox's "bfcache".
Should FF's back/forward behavior still work as described here:?
https://developer.mozilla.org/en/using_firefox_1.5_caching
(the page is 6 years old? - perhaps things have changed)

Recently I've been trying to figure out how to get the back-button to work when going back to a page where the dom has been modified (ie, the page should be as the user left it). Specifically a form where fields have been revealed/modified based on values of other fields.. common stuff.

My searches lead me to bfcache and the understanding that it should "just work" (assuming no "no-store" / "no-cache" headers... or unload handlers are used, etc). The thing is, I can't find a page/site where bfcache works as described. It seems the page is always redrawn and the onload event is always fired.

I've created a most basic page to test bfcache (no external javascript, images, stylesheets)
http://www.bradkent.com/test/bfcache.html

The page captures 3 events: load, pageshow, & focus
each event handler appends a "debug" div to the body

When using the back/forward button to return to the page: page is always redrawn & onload is always fired...the page is not as it was left... further, pageshow's persist property is always fals.
It doesn't matter whether I load the page via http:// or file:// (I assume that would rule out any caching headers issue)

I must be doing something wrong??
I'm using Firefox 8

Martijn

unread,
Dec 12, 2011, 11:10:46 AM12/12/11
to mozilla.de...@googlegroups.com, dev-pl...@lists.mozilla.org
Iirc, as soon as you listen for the 'pageshow' event, bfcache is turned off.

Regards,
Martijn
> _______________________________________________
> dev-platform mailing list
> dev-pl...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform



--
Martijn Wargers - Help Mozilla!
http://quality.mozilla.org/
http://wiki.mozilla.org/Mozilla_QA_Community
irc://irc.mozilla.org/qa - /nick mw22

Boris Zbarsky

unread,
Dec 12, 2011, 11:26:04 AM12/12/11
to
On 12/12/11 10:39 AM, Brad Kent wrote:
> I've created a most basic page to test bfcache (no external javascript, images, stylesheets)
> http://www.bradkent.com/test/bfcache.html

On that page, if I click the link and then hit the back button, I see
the DOM as it was when I left and "evt.persisted: true".

> I must be doing something wrong??

Are you testing in a clean profile? Or one with extensions?

-Boris

Boris Zbarsky

unread,
Dec 12, 2011, 11:27:28 AM12/12/11
to
On 12/12/11 11:10 AM, Martijn wrote:
> Iirc, as soon as you listen for the 'pageshow' event, bfcache is turned off..

Not at all. That would completely defeat the purpose of having a
pageshow event!

The event listeners that turn off bfcache are unload and beforeunload.

-Boris

Brad Kent

unread,
Dec 12, 2011, 12:15:30 PM12/12/11
to
Thank you for your time!
It turns out, LastPass is breaking bfcache
https://addons.mozilla.org/en-US/firefox/addon/lastpass-password-manager/

ugh

Boris Zbarsky

unread,
Dec 12, 2011, 12:21:16 PM12/12/11
to
On 12/12/11 12:15 PM, Brad Kent wrote:
> It turns out, LastPass is breaking bfcache
> https://addons.mozilla.org/en-US/firefox/addon/lastpass-password-manager/

Report the bug to them?

-Boris

Asa Dotzler

unread,
Dec 12, 2011, 1:56:53 PM12/12/11
to
And report a bug to us. Apparently LastPass also causes massive leaks.
https://bugzilla.mozilla.org/show_bug.cgi?id=674535

- A
0 new messages