Web Page Cache / Refreshing

Could someone please help me with this?

Is there a simple way (maybe within the Xlecom programme) to force a "Refresh" of my web pages on customers' Browsers? The problem i'm having is that, although I update my website every week,my customers browsers are sometimes using the "older" version of the page, due to their browsers caching preferences.

A Solution to Web Page Cache / Refreshing

This should not really be a concern since most browsers are set by default to check for newer versions of stored pages. If however, a user has manually changed their browser settings to not to check for newer versions of stored pages, which is very rare, then this would be a concern in that particular circumstance.

You can control Web Page Caching / Refreshing by using the META tag method or the JavaScript method mentioned below. In either case, you add the code to the HEAD section of your pages.

In XLEcom, you can add any custom code to your site's web pages by using the "Additional Code" utility. See the following page for more information: Adding Your Own HTML or Scripting Code

Adding the META tags is a good start but it doesn't always do the trick as ISP and other proxy caches don't actually read (parse) the HTML and may keep your document in their cache anyway. The only way to be sure is to use HTTP headers. This can be done easily if you were using a server side scripting language such as PHP, ASP, etc... In this case for static HTML pages, your options are as follows.

The META Tag Method

Option 1 - Automatic Page Refresh
Adding the following META tag to the HEAD section of your pages will cause the current page to refresh in 2 seconds (content="2"). Changing content="2" to content="0" will cause an instant refresh.

<META HTTP-EQUIV="refresh" content="2">

Option 2 - No Cache
Add the following META tag code to the HEAD section of your pages. This will tell the browser not to cache the page to the system.

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Pragma-directive" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Directive" CONTENT="no-cache">

The JavaScript Method

Option 1 - Using JavaScript - Automatic Page Refresh

<script type="text/javascript">
window.onload = function () {
// -->

Option 2 - Using JavaScript - Automatic Page Reload

<script type="text/javascript">
window.onload = function () {
// -->

What is the Best Option to Use?

The META Option 2 - No Cache method is probably the best option to use. You can test it out by first clearing your local computer's Temporary Internet Files folder and making sure that the folder is empty. Next, visit a page in your website that is located on the web. If the No Cache method worked properly, then the page you just visited should not have been written to your Temporary Internet Files folder.

Sam Raheb
XLEcom Program Developer

Thanks for those workarounds

Thanks for those workarounds Sam. But, before I try them, is there anything else that could have caused this to happen? I recently upgraded the Xlecom program and have just realised that I hadn't put my usual options in the Meta-tags. Its just that the two customers that it happened to recently swear that they hadn't visited my site before...

RE: Thanks for those workarounds

Putting or not putting your usual options in the Meta-tags would not cause this from happening. The most common possible reasons are the following:

Possible Reason 1:
One way for that to happen is if your visitor happened to visit an old copy of your site located at a different location.

Possible Reason 2:
They performed a search via a search engine and viewed a cached copy of your page that the search engine stored.

Possible Reason 3:
Another possible reason could be that they bookmarked (added to their favorites) an old web page that you used to use which you didn't remove it off the web server.

If you are using the main_category_sub_category.html page naming option, then keep in mind that the page names are constructed using both the main and subcategory names. So if you change any of the main and subcategory names, then the page names will change too. In this case, you should remove all the old *.html files from the web server and upload only the newly published ones. This is why there is a "Delete last Published website" option under the Publish routine. This way you won't accidentally upload old unwanted web pages.

Sam Raheb
XLEcom Program Developer

I think that the problem was

I think that the problem was "possible reason 3" Sam. Thanks for that. It seems that I did, indeed, change the category names after a recent upgrade and although I used the "delete last published website" option, the older html pages remained on the server with the new ones.The older ones were named page1, page2 etc. I imagine that this was probably the cause of the problem do you?

RE: I think that the problem was

I thought that "Possible Reason 3" was the most likely cause of the problem.

This is a common mistake many web designers make and it is independent of what software package they used to create their website.

To avoid this problem in the future, you need to make sure when you update your site, that you remove all the old obsolete web pages from the webserver.

The easy way to identify and remove the old obsolete pages on the webserver is to:

(1) Upload your new website
(2) Within your FTP client, sort all the files under the html folder by date
(3) Remove all the HTML files with the old dates.

By the way, the "Delete last Published website" option under the Publish routine only deletes the last Published website from your local computer and not from the webserver.

Sam Raheb
XLEcom Program Developer