• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

website html pages are not changed in realtime!?

Dear,
I have windows server 2008 which hosts my website.
in my website, I have 2 html pages: index.html and 1.html where in index.html there is a hyperlink to 1.html and vice versa.
If I go to index.html, and it shows in my chrome browser, then i edit it using filezilla ftp software, and repast the link in the browser new tab, i found that the old page is showing and not the new edited page. and the new page will not appear else if I press "F5" in the browser tab, and if i edit the 1.html too, i see that the 1.hml also keeps showing old data, till pressing F5.
How can I force the server to always show my last edited html files, and not by only when pressing F5!?
Thanks for your help
Note: same thing with aspx and php file, not reflecting edited files else after pressing F5
0
hassanayoub85
Asked:
hassanayoub85
  • 6
  • 4
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
You have discovered browser caching where your browser uses the last version of a page that it has loaded unless you force it to get a new version from the server.  The only way to stop that is to set the cache 'expiration' time to 0 on the server.  

While it is tempting to do that as a developer, caching actually speeds up browsing for the 'normal' user by not having to download files that have not changed.  Google's PageSpeed recommendations are that you make the cache expiration much Longer rather than shorter.  Cached files are displayed more quickly than files that have to be retrieved from the server.

I would recommend that you get used to pressing F5 while you're still developing the page.  Shortening the expiration to 0 only benefits you.  Overall, it slows your site down for your users.  

One other thing to note is that CSS and javascript files are also cached and if your 'new' page uses the same file names as the previous versions of CSS and javascript files, they may not load as you expect either.  A few times I have had to load CSS and/or javascript files in the address bar to pick up the new version and then go back to the page and press F5 to get everything to load properly.
0
 
duncanb7Commented:
if your computer allow to run php , You can  save your html page to php file which  won't be cached, for example,
copy 1.html to 1.php and add <?php  ?> on the top in the file  similar to following file.

For convert to asp file, it might work  but need to check

Duncan

1.php
========
<?php

?>
<hmtl>
...........
</html>

Open in new window

0
 
hassanayoub85Author Commented:
Dave Baldwin:
How can make server dont allow caching at all?

duncanb7:
I tried both, php and asp.net, but same result as htlml
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
duncanb7Commented:
it won't , server language page  won't be cached,

Please click "request attention" button, other experts will assist on this subject.

Duncan
0
 
hassanayoub85Author Commented:
Wow, Ive jsut test it and seems everything is right, i will do more testing and get back to you
0
 
hassanayoub85Author Commented:
ok tested many times and eveything is right o the pc (chrome browser).
However weird things appearing on my mobile!!!
i changed the 1.php and 2.php files on server, on pc gets refreshed always and get the new and latest version, but on my mobile it wont get the last file till i either:
1- go to the application and clear on clear cache, then reopen the application.
2- or, click on the address bar and click go, like pressing F5, so it seems that mobiles are caching the contents?
Any ideawhile mobile is caching he php filesand how to avoid this?
I am using acroid kitakt and chrome browser
0
 
Dave BaldwinFixer of ProblemsCommented:
How can make server dont allow caching at all?
You can't... because it isn't.  Your browsers are doing the caching.
0
 
hassanayoub85Author Commented:
but "duncanb7" said the browsers dont cache php files!?
0
 
Dave BaldwinFixer of ProblemsCommented:
"duncanb7" is only half right.  Browsers will cache the HTML that PHP files generate which is the part that you see.
0
 
hassanayoub85Author Commented:
So, my problem is not solvable?
0
 
Dave BaldwinFixer of ProblemsCommented:
Not without creating other problems.  The exact method depends on the web server you are using.  You would have to go into your web server setup and change the expiration time (that is sent with every file access) to 0.  That means not just the HTML/PHP files but also all image files, CSS files, and javascript files.

However... doing that will mean that the users of your site will see it load Every Time like you did a complete Ctl-F5 refresh every time.  If you leave it alone, then many files will be cached so they load from the local browser cache quickly instead of downloading from the server each time.
0
 
hassanayoub85Author Commented:
Wow thanks solved by he timestamp issue
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 6
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now