PDA

View Full Version : Why do no browsers seem to have the ability to do a REAL force refresh?



hoppipolla
November 28th, 2009, 07:57 PM
This is annoying me soooo much ._.

I make a change to my site (something small), switch to Chrome and refresh... no change. I press F5... no change. I press Ctrl+F5 or Shift+F5 or Shift/Ctrl+Refresh button... no change :(

I open a new browser which hasn't viewed the page before and suddenly I can see my change(s)!

So why can't I just force Chrome or Firefox or whatever to completely reload the page without checking it's cache or anything? It would save me so much time!

Thanks all!

Hoppi :)

Islington
November 28th, 2009, 08:22 PM
holding down the Shift key while clicking on the refresh button works for me. ctrl f5 seems to be a windows specific thing.

Islington
November 28th, 2009, 08:23 PM
Edit: I was wrong ctrl+f5 should work: http://support.mozilla.com/en-US/kb/Keyboard+shortcuts

hoppipolla
November 28th, 2009, 09:26 PM
I know they SHOULD it's just... they never seem to ._.

Not when doing loads of changes to your site, I just find that it might refresh the images but it doesn't grab the html from the server again, which is what I need it to do ._.

dragos240
November 28th, 2009, 09:29 PM
CTRL + R usually works for all browsers.

BuffaloX
November 28th, 2009, 10:24 PM
CTRL + R usually works for all browsers.

Thanx I'll try that next time, usually I have to purge my cache, then refresh.

Can anyone confirm this really works. It seems to work, but I don't have anything to test on right now.

jpmelos
November 28th, 2009, 10:36 PM
Weird, for me it always worked with a simple CTRL+F5... Even if I change a single character on the page. I'm using Firefox 3.5.5.

Hells_Dark
November 28th, 2009, 10:40 PM
Maybe your server doesnt refresh as fast :D

(I mean it's not always browser fault… servers, routers, etc)

v8YKxgHe
November 28th, 2009, 10:42 PM
This is why it's quite common to append a number query string to things like JavaScript files etc, to force the browser to download the new version, e.g. assets/js/foobar.js?1234

Ylon
November 28th, 2009, 10:56 PM
Looks like an issue relative to .css file.. wich were usually treated differently than other page elements.

hoppipolla
November 29th, 2009, 01:33 AM
CTRL + R usually works for all browsers.

I'll give that one a go :)


This is why it's quite common to append a number query string to things like JavaScript files etc, to force the browser to download the new version, e.g. assets/js/foobar.js?1234

I don't fully understand this, do you mean just renaming the file?

v8YKxgHe
November 29th, 2009, 10:52 AM
I don't fully understand this, do you mean just renaming the file?

Renaming the file would work, yes. However what I mean is to just append a query string to the URL, because to the browser this is a different URL now and so downloads the 'new' copy. It's a very common thing to do on production sites (and large development teams) since it ensures that end-users wont get a half-broken site if you example, you change the CSS but keep the same name.

spupy
November 29th, 2009, 12:25 PM
It's not always the browser. I think some proxies do caching as well. The remedy in that case is the mentioned method of appending some nonsense to the url.

SunnyRabbiera
November 29th, 2009, 02:18 PM
Clearing cache is the only real way to keep pages 100% refresh.
I use no cache personally, I always set mine to 0MB in firefox/opera.

betrunkenaffe
November 29th, 2009, 02:47 PM
Kill the cache when doing testing on your own work. You will save yourself alot of pain.

That being said, a master refresh only forces the browser to grab the latest of the target page (not every page that the target links to). Hence the css and js files will all be out of date. I've never tried the suggestion to append "?version" but looks like it will work. Does that work for css files as well because that will save me alot of grief at work where I can't turn off cache. :)

v8YKxgHe
November 29th, 2009, 03:16 PM
Kill the cache when doing testing on your own work. You will save yourself alot of pain.

That being said, a master refresh only forces the browser to grab the latest of the target page (not every page that the target links to). Hence the css and js files will all be out of date. I've never tried the suggestion to append "?version" but looks like it will work. Does that work for css files as well because that will save me alot of grief at work where I can't turn off cache. :)

It works for anything, it's just a URL.

chucky chuckaluck
November 29th, 2009, 03:19 PM
does setting cache at 0 hurt the back button's functioning?

v8YKxgHe
November 29th, 2009, 03:29 PM
You really shouldn't set your browser to not cache, if anything but to help take load of peoples servers.

hoppipolla
November 29th, 2009, 05:26 PM
Renaming the file would work, yes. However what I mean is to just append a query string to the URL, because to the browser this is a different URL now and so downloads the 'new' copy. It's a very common thing to do on production sites (and large development teams) since it ensures that end-users wont get a half-broken site if you example, you change the CSS but keep the same name.

oh ok, so... any URL? So like let's say we have one of my sites:

http://www.twitteractivism.com/index.php ... what comes after? ?12345 ?

Sorry, I'm not too hot on this stuff! And then I just change the string of numbers to make it reload?

oh and my other one is html... same deal?

Sorry, excuse my ignorance on this one! :)

v8YKxgHe
November 29th, 2009, 05:48 PM
oh ok, so... any URL? So like let's say we have one of my sites:

http://www.twitteractivism.com/index.php ... what comes after? ?12345 ?

Sorry, I'm not too hot on this stuff! And then I just change the string of numbers to make it reload?

oh and my other one is html... same deal?

Sorry, excuse my ignorance on this one!

No, it would come after your CSS/JavaScript files. For example:


<script type="text/javascript" src="assets/js/foo.js?v=2"></script>

When ever you alter the JavaScript file, simply change the 'v=2' for 'v=3' or, 4, 5, 6 etc etc. All you're doing is appending what is called a query string to the URL, GET arguments in the HTTP request.

How do you mean with HTML?

hoppipolla
November 29th, 2009, 06:08 PM
No, it would come after your CSS/JavaScript files. For example:


<script type="text/javascript" src="assets/js/foo.js?v=2"></script>

When ever you alter the JavaScript file, simply change the 'v=2' for 'v=3' or, 4, 5, 6 etc etc. All you're doing is appending what is called a query string to the URL, GET arguments in the HTTP request.

How do you mean with HTML?

oh ok i think I understand now!

Although MEGA weirdly, when I just bunged in the equivalent of:

http://www.twitteractivism.com/index.php?1234

it refreshed perfectly! Weird no? Is it just because that's a query being passed to the browser about the page? O.O

It even worked without me having to change the string each time, so I just F5'd the page the 1234 on the end and it did it fine!

Weeeeeiiiird! ^_^

I hope it keeps working as this is SO easy!

ssam
November 29th, 2009, 07:15 PM
surely there is a firefox extension to disable all caching or something similar.