Chrome caching page when pressing previous button - google-chrome

i have a page that displays a list with vuejs, the user can do some update on this list (filters). Whenever he go to another page and then click the back button on the browser, there are still the old parameters (filters), he needs tu press refresh to get it right.
These information are sent from the PHP controller, and are corrects.
Is there a way to prevent browser caching ? i found other topics on the same problem, but no answer was really fine (mostly force page reload, which is not really fine for UX)
do you know any better solution ?

Try deleting the cookies and local storage objects, should work see here:
Clearing localStorage in javascript?

Related

Single Page Application: Disable fast back from Browser?

I have single page application(Rails if it matters), where I am struggling with Browser cache. When user press back button It loads page from cache, not even HTTP 304. I have already set no-cache in response, but I belive browser has another layer of cache on top for single page application to provide fast back.
I understand there are some solutions here:-
Disable browser back button for one page application
https://softwareengineering.stackexchange.com/questions/256363/dealing-with-browser-cache-in-single-page-apps
However all of them involve, having either a popup box, or disabling back button. Both I think are terrible UX choices. Is there any other way to force browser to query server in SPA?

'Back' button and 'history.go(-1)' not working with Chrome

Got an odd problem, only persistent in Chrome browser. Can't imagine what would be the problem. Chrome's "Back" button doesn't work, nor does history.go(-1), but works fine on all other browsers. To see the problem simply click this link, which will asynchronously initiate searches on two separate services, or sites if you will. Upon click on any search result list item, we traverse to another page, but "Back" doesn't work for Chrome.
http://vps-net.com/MSSMine/?search=some
Any suggestions or ideas are welcome.
I found the problem with the page you have linked, I don't believe it to be an issue with Chrome.
When you load the page, it also loads two iFrames as the request to the site finishes. Chrome takes a somewhat different approach to history, allowing you to navigate not simply from changes in the URL displayed, but through every new individual browser-initiated request. When the iFrames load, Chrome adds history for each step of the page loading process, creating 4 separate history items. When you go back 1 "page load", it takes you back to the site you linked to, at a different step in the process. You aren't seeing anything change because as soon as that page loads, any unloaded iFrame now loads again.
If you do history.go(-8) or some other large number, you should see the page at that many pageloads ago. However, if the link is opened "in a new tab" then the history begins for that tab at the URL you told it to open, effectively limiting the history to the pages that occurred during that tab's lifespan.
This was tested on Chrome 34.0.1847.116 running under Ubuntu 13.10.
My back button was not working as well, but it would not work with any browser. I went into my add/delete software and deleted what software was added the night before - BOOM! All is fine now.

Chrome dev tools on all tabs

I'm trying to see a POST request that my browser is making on a certain form.
My problem is that the form is opened in a popup window (js initiated) and when the form is submitted it automatically closes the popup. So when I'm trying to use the developer tools' networking tab I can see the post request but don't have enough time to look into it since the window is closing too fast.
Even if I choose 'preserve log on navigation' it doesn't appear anywhere since the entire window is closing on submit.
Is there a way of opening the developer tools in the context of the entire Chrome application instead of a certain tab?
I don't believe there is. The best two solutions I can think of (that don't actually answer your question but I think achieve your aim) are:
Use another tool like Fiddler - http://fiddler2.com/ It's really good but only available for windows :(
It's a messy workaround but you could just comment out the line that closes the window while you carry out your debugging and then reinstate it once the issue is fixed.

Can I clear browser cache of the page leaving page?

Can I clear browser cache of the page when I'm leaving it.
// Clear browser cache
Response.Redirect("otherpage.html");
By "clean browser cache" I didn't mean all the cache. I meant make user download the page next time he goes back to it (by pressing back button in my case).
Edit
Usually Sky Sanders suggestion works. In fact that what I tried right away, but even though it worked for simple page it failed when putting Response.Redirect after cache headers. Even though FF received headers it still provided me with a cached page when I pressed back button.
The only way you can control caching from the content end of the stick is to prevent caching in the first place.
context.Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.Cache.SetNoStore();
You cannot invoke methods on the client browser.
No, you can't clear the browser cache from your web app. You could clear the cookies but that's about it.

What would cause a visitor to return to the top of the previous page, instead of to the point in the page where the link resides?

I've seen this weird behavior on several sites recently: I scroll down a page and follow a link to another page. When I click the Back button and return, I am left back at the top of the previous page, not at the link. This is very annoying if I'm clicking on links in a search results page or a list of "10 Best Foo Bars...".
See this page as an example. Strangely, the page works as expected in IE6 on WinXP, but not on FF2 on the same machine. On Mac OS X 10.4 it works in FF2, but not in FF3. I checked for any weird preference settings, but I can't find any that are different.
Any idea what is causing this?
Many sites have a text box (for searching the site, or something) that is set to automatically take focus when the page loads (using javascript or something). In many browsers, the page will jump to that text box when it gets focus.
It really is very annoying :(
Typically this behaviour is caused by the browser cache set by the site having a small or no time before expiry.
On many sites, when you hit "back" you get brought back to the link you hit, as your browser is pulling the page from your cache. If this cache has not been set, a new page request is made, and the browser treats it as fresh content.
On the page linked above, the "Expires" header seems to be set to less than a minute ahead of my local clock, which is causing my browser to get a fresh copy when I hit "back" after that expiry time.