Solved

website html pages are not changed in realtime!?

Posted on 2014-07-25
12
219 Views
Last Modified: 2014-07-27
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
Comment
Question by:hassanayoub85
  • 6
  • 4
  • 2
12 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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
 
LVL 13

Expert Comment

by:duncanb7
Comment Utility
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
 

Author Comment

by:hassanayoub85
Comment Utility
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
 
LVL 13

Expert Comment

by:duncanb7
Comment Utility
it won't , server language page  won't be cached,

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

Duncan
0
 

Author Comment

by:hassanayoub85
Comment Utility
Wow, Ive jsut test it and seems everything is right, i will do more testing and get back to you
0
 

Author Comment

by:hassanayoub85
Comment Utility
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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
How can make server dont allow caching at all?
You can't... because it isn't.  Your browsers are doing the caching.
0
 

Author Comment

by:hassanayoub85
Comment Utility
but "duncanb7" said the browsers dont cache php files!?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
"duncanb7" is only half right.  Browsers will cache the HTML that PHP files generate which is the part that you see.
0
 

Author Comment

by:hassanayoub85
Comment Utility
So, my problem is not solvable?
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
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
 

Author Comment

by:hassanayoub85
Comment Utility
Wow thanks solved by he timestamp issue
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now