• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 113
  • Last Modified:

refresh of aspx page

I have a web aspx page that has a button that once it is clicked, it updates a table and response.redirects to a pdf file.

When I click on the back arrow of the in the pdf, the field that is supposed to be displayed is not displayed until I manually hit the F5 key.

In another words, the 'Complete' label is not visible when you go into the page, but needs to be visible when I return from the pdf.
  • 2
1 Solution
That behavior is browser dependent, but the back button on recent browser use the cached rendering and doesn't refresh or execute code.
To prevent that just add an onunload event
sjs091654Author Commented:
How do I do that?   I also noticed that the 'Complete' label will appear if I don't redirect to another page on clicking the button
Just add an empty anonymous function as the listener.
The mere presence of the event listener is enough to disable the caching when using back.

window.onunload = function (){};
window.addEventListener ("unload", function (){});
$( window ).unload(function() {};
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now