Force Refresh when user clicks back button

Force Refresh when user clicks back button


I have an application with a relatively standard search screen.

The issue is that when someone clicks back, despite the fact that the search term is correctly stored in a session variable, the actual list results are not being refreshed.

I've read in other places that this is because the back button doesn't trigger the preperation or the refresh.  

I've set the cache time to 0 on the search page, and attempted to keep the result set in a session variable.  Neither of those seem to help.

The question I have: Is there a way to detect that a user got to this page via the back button, and force a page refresh action?

Hi Tom

When you refer "back button" are you talking about browser back button, or is it a link in your web application?

I think the back button form browser, preserves the last fetched list. In the case of an application link, you can add a boolean input parameter to your scren, that is filled with true, when you click in back link.

I have the same question as Tom.

For clarity:

I have a page if you type some numbers in the min and max price and press Search you will go to the next page as expected. If on this page you alter the values the search is executed as expected (onChange).... but if you press the browser back button the old min and max values are presented - not the new session variables.... how can I force this screen to refresh to display the session vars?



What I ultimately ended up doing, though I don't recall where I found it to add a link to it, was the following:

  1. Add a textbox in a container with Display = false, tied to a text variable on the screen
    1. The variable is defaulted to "No"
  2. Added an onload extended property to the screen, with the following javascript
    1. "$('#" + Refresh.Id +"').val() == 'yes' ? location.reload(true) : $('#" + Refresh.Id +"').val('yes'); return false;"
  3. This will cause the screen to reload if the back button is pushed, by setting reload to yes on the initial load, and then if the back button is used, when the screen is reached again, will trigger the reload
    1. This does have the drawback of causing the screen to reload.  For what I was doing, it wasn't an issue.

J. wrote:

I think Thomas solution is roughly the same as :

Yes, I think that's the one that was being referred to.

Thanks Guys... the link to the post 

Worked for me.! :-)