Announcement Announcement Module
No announcement yet.
Webflow, Ajax and browser's history/back button. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Webflow, Ajax and browser's history/back button.

    Is there is any way to fix famous "Ajax vs browser history" problem with SWF?

    sitrep: Classic example ("phonebook") - Flow view with a table. But table is updated (sorting/pagination) via Ajax. There are "details" links in the table. After going several table's pages forward user clicks "details", views details and goes back, using browser's back button.

    problem: After going back in browser's history table displays first page, because any calls made with Ajax are not recorded in browser's history.

    There are several ways to fix that, all using javascript. As far as I know - none of them is 100% bulletproof.

    Has anyone got any experience implementing a fix in SWF environment?

  • #2
    ...and by "SWF environment" - I mean, not converting an existing Javascript solution, but rather using SWF mechanics itself.

    Basically, the idea is that when user executes page forward/backward links (refreshes the same flow view (or should it be a subflow?), by ajax call) the state of "original" flow - changes to include "page" parameter with a correct page set. So next time user "backs" to the table view a correct table page is shown.

    Is that possible?


    • #3

      I'm thinking if you had an "outer" (or root) flow context in a view-state that rendered a inner "table flow" context, you could easily track the state of the inner flow as it changed in response to local events being signaled on each async request. So when you'd go back you'd undo the previous table event, and your "outer" flow would render the previous page correctly. Back button would work as in your browser you'd go back to a previous continuation with a different _flowExecutionKey (referenced via a unique URL).

      This sort of stuff is very interesting to me but is currently not supported out of the box. The ability to signal an event on an independent, local flow contained by a parent flow as part of a flow hierarchy (or component tree) is not yet supported by the current Flow Execution implementation. It could be added, and this significant enhancement is being tracked by the following JIRA:

      Last edited by Keith Donald; Jan 30th, 2007, 04:36 PM.


      • #4
        Well, thinking about this, I'm not sure if this would solve your problem with Ajax in the mix, as the async request from the table would not cause the browser URL to change...



        • #5
          Yes, not changing url is the root of the problem. But what I had in mind is the following (please mind: I am new to the SWF, so - this may sound somehow stupid..):

          Let's say we have following states in our flow:
          1. Original state (with some _flowId). Table is on page-1.
          2. User pages one page forward - ajax request - url is not changed. Table is on page-2. new _flowId is generated for state #2.
          3. User goes into "details".
          4. User presses back. Browser goes back to state #1, with table on page-1.
          Now, the desired behaviour in step #4 is obvious - browser goes back to state #2.

          The question is - is it possible to "assign" state #2 to _flowId of the state #1?

          There are a lot of trivial ajax tasks around which do something like that - change the state of the page they are on. Creating a complex constructs in xml configs for such (rather simple) task might be undesired.

          Now - I understand that this functionality is not there out-of-the-box, and want to see if I can implement it myself. Could you, please, point me in the right direction where to look in SWF codebase?

          Thank you.