Search code examples
htmlcachingbrowserrefreshjgrowl

What is the difference between using the back-button to return to a page and hitting the refresh button while on that page? (for jGrowl)


There is a bug I am researching that during the process I discovered different results between the following two scenarios:

Scenario 1) A link with no get or post data brings me to page A. On page A I perform several AJAX calls that refreshes and changes some data displayed on the page. Then I click on a link to page B. To return to page A I click the back button.

Scenario 2) A link with no get or post data brings me to page A. On page A I perform several AJAX calls that refreshes and changes some data displayed on the page (same as Scenario 1). Then I click the refresh button.

What is the difference between these two scenarios in addition to non-hidden input fields being repopulated?

Specifically what I'm encountering that has prompted this question is that jGrowl is re-displaying messages on page A upon clicking the back button but is not re-displaying the messages if I hit refresh. I suspect this is by design in jGrowl or a side effect of the nature of the difference in the two scenarios above. Any thoughts on this would be helpful, thanks.


Solution

  • jGrowl will only display what it is told to display for the particular state of that page. It has no session or concept of history. If you click 'back' and the page you are going back to has the same $.jGrowl("Message") calls from the first visit then those will execute just the same. The way to avoid this is to change the caching headers on the page so that it will be fetched new.