source code changes do NOT reflect immediately upon uploading them on my web host
Asked Answered
L

3

5

This is not a programming question per se. I am using a free web host called getfreehosting. I am using their online file manager to transfer files. From time to time, the changes I make on source code do NOT reflect immediately after I upload them. I.e. when I run my application on Chrome, then go to view page source, I realize the JavaScript running is still the old version! In most cases this doesn't happen but when it does it is extremely frustrating. I've tried clearing the browser's cache. I even tried editing the file directly on their servers. Sometimes it solves the problem but other times it doesn't.

Is this a common issue encountered when transferring files to a web host? Or perhaps this is one of the downsides of using a free web host?

Thanks.

Lessen answered 17/4, 2013 at 1:10 Comment(0)
K
5

You can try clearing your browser's cache, or the ol' CTRL+F5 refresh trick. Otherwise, the hosting provider may be using a caching layer to help ease resource usage.

Kentigera answered 17/4, 2013 at 1:13 Comment(0)
I
3

It is the responsibility of the server to indicate to the browser what the cacheable lifetime of the script files are when they are served to the browser (1 hr, 1 day, 1 month, etc...). This is a server side setting.

Caching is very important for both server-side efficiency and client-side performance so you don't want to defeat it completely.

You can either shorten the server-side setting for the cache lifetime or you can use a version number in your script files (like jQuery does) so that when you revise your script files, you give them a new filename like "myscript-v12.js" and update the corresponding HTML files to refer to the new filename. Then, as soon as the browser gets the new HTML file, it is guarenteed to get the new JS file because the new filename could never have been in the browser cache.

If this is just an issue for you personally while developing and revising your site, then just clear your browser cache after you upload new files and then when your browser loads that page, it won't have any version in the cache and will be forced to get the new version from the server.

Italy answered 17/4, 2013 at 1:21 Comment(0)
L
2

There is a CACHE system in modern browsers. Try clear cache before you browse your web site.

Loot answered 17/4, 2013 at 1:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.