I'm trying to prevent a "flicker" effect that is occurring on my ASP.NET page which occurs when a user navigates to the page via the browser back button after having navigated away from it. The reason for the flicker is that I'm using an Update Panel which has some content in there on the initial page-load. As a result, when the page is loaded via a back button that initial content is shown very briefly before it is updated with the correct History-aware data.
In order to overcome this I am intending on having the updatepanel hidden (display: none) on inital page load and then show it as long as we don't have any history to deal with. The problem is that I can't find out what to check to determine if there's any history. I can see that the Sys.Application has a _history member but when I'm checking it on page init it is null each time.
Does anyone know what I should be checking to determine if there's history to deal with for a page load client-side? And at what point to do it?
The browser's back button and the functionality that it provides is completely independent of the content of your web page.
One thing you might be able to do is set your location hash when you do an AJAX update. You might be able to detect this when you load a page. I haven't tried it. You should be able to parse out the # portion of the url on the Server Side and see where you are in the AJAX history.
location.hash = 'foo';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With