Solved

refresh of aspx page

Posted on 2014-12-22
3
78 Views
Last Modified: 2015-03-11
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.
0
Comment
Question by:sjs091654
  • 2
3 Comments
 
LVL 7

Expert Comment

by:Gauthier
ID: 40513376
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
0
 

Author Comment

by:sjs091654
ID: 40514771
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
0
 
LVL 7

Accepted Solution

by:
Gauthier earned 500 total points
ID: 40515756
https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers.onunload
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 (){};
or
window.addEventListener ("unload", function (){});
or
$( window ).unload(function() {};
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question