0

When I make changes on my html page and I go to check it on the browser, the changes are not visible yet, I must refresh the page to see the new stuff.

I used the following jquery script :

$(window).load(function() {
    location.reload(true);
    // preloading animation
    $('#pre-anim').delay(1000).fadeOut();
    $('#pre-overlay').delay(1350).fadeOut('slow');
});

I tried the location.reload with true for reloading the current page from the server and not from the cache. But it does not work...

What do I do wrong ?

EDIT : to make it clearer... Fot those clients who already visited my website before, the changes are not visibles because the browser charges the cache, so the clients must refresh the page manually. I would like that the browser charges the new files from the server and not from the cache...

If I use the given codes (above), my page does not stop refreshing without stop.

Igor Laszlo
  • 714
  • 9
  • 31
  • What I understand is that, when server have changes you need to refresh client page automatically. If yes then have a look on SignalR and similar libraries – Mehmood May 09 '17 at 11:51
  • @Mehmood - when the html page has changes on the server, the page must be loaded with the changes for the client. Unfortunately, when I make changes, the clients whom already visited the page before, at their next visit they see the old version because of the cache of the browser. I would need to charge the page without the cache, it means the new files from the server directly... – Igor Laszlo May 09 '17 at 16:10
  • 1
    @IgorLaszlo that's some serious caching you have, I don't think I've ever seen a case of this - are you using any 3rd party caching systems on your server? Also check settings for cache lifetimes etc. – treyBake May 09 '17 at 16:23
  • I guess it's a duplicate: http://stackoverflow.com/questions/8155064/how-to-programmatically-empty-browser-cache/ – caramba May 09 '17 at 16:23
  • @ThisGuyHasTwoThumbs - I do not understand your question... I am talking about client side, how can I do choose their caching system ??? No any third party in the things... I have a very simple HTML5 page : www.immobillio.com – Igor Laszlo May 09 '17 at 16:31
  • @caramba - I asked what is the problem with my code, also I do not use "log out" and any confidential data. The post you gave me for possible duplicate, I do not see any common thing... he ask a general question, I ask something very concrete... – Igor Laszlo May 09 '17 at 16:34
  • Well for that I suggested you some third party tools, you can also add Metadata tag in HTML Header to refresh the page. So it will refresh after a period of time. Google it for "metadata refresh in html" – Mehmood May 09 '17 at 16:52
  • I already found this : ` ` but I am not sure that it is valid for HTML5... – Igor Laszlo May 09 '17 at 17:33
  • Anyway, even if it is not perfect for HTML5 I guess, I added now the above mentioned meta tags (you can check it on www.immobillio.com) but the page does not load the new file from the server but from the cache, so it does not show the new data for client without manual refresh... – Igor Laszlo May 09 '17 at 20:49
  • @IgorLaszlo the files are hosted on a server, not the client's browser. Caching works by storing the location to a temp location so it can just call that instead of having to fetch it from the server each time.. my question was is your host server running any file caching like Varnish? – treyBake May 10 '17 at 08:31
  • @ThisGuyHasTwoThumbs - I never heard about what you ask, I know what means "cache" but I do not know anything about caching systems. If you want to say that the codes what I gave above are good and it should work, the only thing to check it if I will put again the codes and I ask a friend to check if it works at his side in the same time... I will come back with this... – Igor Laszlo May 11 '17 at 21:59

0 Answers0