How to refresh a page when a button is clicked in a browser (IE, Chrome, Firefox Safari)?

Most browsers reload the page from the cache and do not update the two-way server. I added Response.AppendHeader ("Cache-Control", "no-store") on the_Load page, but didn’t work in Chrome, Firefox, Safari. How to refresh a page when a button is clicked in a browser (IE, Chrome, Firefox Safari)?

+6
source share
2 answers

This will be for your C # code, which I assume. These are my offers in the order of the smallest offer.

Response.Cache.SetNoStore(); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.AppendHeader("pragma","no-cache"); Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1)); 
+5
source

This is probably a bad idea to force this behavior, because the user expects to see what he saw before, and not an updated view. If this is the behavior of Chrome / Firefox / Safari, then, apparently, users want this behavior because they chose this browser. If they want to update the presentation, they can update themselves.

However, I often see that this is done with Javascript in the browser. You can connect to page load events and refresh manually if the second page loads. But if the client uses noscript or otherwise does not support Javascript, you're out of luck. Also, be careful to reload correctly so that users don’t get to a new page every time they click β€œBack” and get stuck in a battle of quick clicks.

+2
source

Source: https://habr.com/ru/post/893612/


All Articles