Welcome Guest, Not a member yet? Register   Sign In
Strange problem with browser cache
#1

[eluser]earlyriser[/eluser]
Hello
I have this fonction in the 'Welcome' controller

Code:
function test()
    {                
        echo time();
    }

ONLINE:
When I load the page it shows the current unix time. If I reload the page it doesn't get updated. I need to press CTRL F5.

ON LOCALHOST
The page is refreshed in every reload (without ctrl F5).

Is that normal? That happens in Chrome, Firefox and IE.


BUT
if I autoload the session library, it get refreshed everytime online and on the localhost.


Well I don't know actually if that's a problem, but I would like just to understand why this is happening in this way.

Thanks.
#2

[eluser]mddd[/eluser]
Some browsers will load the page out of cache if they think it is the same page.

But when is it "the same page"? Some people use tricks like loading mypage.php?123456. If you change the number every time, the browser will think it is a different page even when it is the same.

Likewise, if information in a cookie changes (like the session library uses), that too can be a reason for the browser to try and reload the page.

As to why the caching happens only in the online version: maybe the browser is programmed to always reload local files. After all the main reason for caching is to increase speed and local files are usually already very fast to load.




Theme © iAndrew 2016 - Forum software by © MyBB