← Back to team overview

launchpad-dev team mailing list archive

Re: AJAX history breakage

 

On 09-07-31 10:05 AM, Gavin Panella wrote:
Hi Maris,

I just had the following conversation (edited for clarity) with BjornT
and intellectronica:

  <allenap> BjornT: I made a dogs dinner of that. Changed the status
    inline, clicked on the milestone just to check it out, went back
    one page, changed the milestone and the status was reset to
    Triaged at the same time. Changes to the page made by Javascript
    do not get remembered in history, or they didn't here.

  <allenap> BjornT: I wonder if there's a way to invalidate a page
    from Javascript, forcing a browser refetch when moving in the
    history.

  <BjornT> allenap: i don't think so. that's one thing that generally
    sucks with ajax sites; history doesn't work well

  <intellectronica> allenap: there are tricks to control the history
    when using ajax, but we don't use anything yet (it needs to be
    consistent for the application as a whole)

Have you given this any thought for Launchpad? What are our options?


That is a new problem for me. As Aaron said, YUI has a component built specifically for this purpose:

  http://developer.yahoo.com/yui/3/history/

It records the page state in the URL #fragment portion. However, this is not without limitations, not the least of which is making the fragment useless for in-page anchor navigation :(

  http://developer.yahoo.com/yui/3/history/#limitations

A better solution may be fast update polling, or POST tokens. Imagine that you leave a bugs page open for a day, then update the status via AJAX - and stomp on someone's changes. You can solve this by sending unique POST tokens with each request, or by polling for page updates, or both. That same solution would re-check the page when you navigated back using the browser history, invalidating the page for you.

Maris

Attachment: signature.asc
Description: OpenPGP digital signature


References