Solved

refresh of aspx page

Posted on 2014-12-22
3
80 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

828 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