Previous Thread
Next Thread
Print Thread
Rate Thread
Finished-[6.2-6.3-6.4-6.5] Allow Visited Pages To Be Cached By Browser #263594
11/27/2003 4:23 AM
11/27/2003 4:23 AM
Joined: Sep 2003
Posts: 524
Twisty Offline OP
Code Monkey
Twisty  Offline OP
Code Monkey
Joined: Sep 2003
Posts: 524
Mod Name / Version: Allow Visited Pages To Be Cached By Browser

Description: Some hosts use an HTTP header which prevents already visited forum pages from being cached by your browser.

Thus, when you use the back/forward browser buttons, you will need to reload every single page fresh again, which greatly slows down forum browsing for dial-up users when jumping in and out of threads, as well as increases bandwidth usage.

This mod will allow you to override their HTTP header with your own, which does permit caching.

All clicked on links will still always load fresh - that functionality won't be affected whatsoever. This way the *user* can decide if they wish to draw from their cache or reload from the server.

Many hosts already use the following configuration by default, but for those that don't (eRoute for example), here's the fix...



Working Under: UBB.Threads 6.2-6.3-6.4-6.5

Mod Status: Finished

Any pre-requisites: none

Author(s): Twisty

Date: 11/27/03

Credits: none

Files Altered: templates/default/ubbt_header.tmpl

New Files: none

Database Altered: no

Info/Instructions:


Change ubbt_header.tmpl

FROM THIS:


Code
&lt;? //UBBTREMARK <br />echo &lt;&lt;&lt;UBBTPRINT <br />&lt;!-- START OF header.tmpl TEMPLATE --&gt; <br />&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <br />&lt;html dir="{$ubbt_lang['READ_DIRECTION']}"&gt; <br />&lt;head&gt; <br />$headerinsert <br />$refresh <br />&lt;meta http-equiv="Content-Type" content="text/html; charset={$ubbt_lang['CHARSET']}" /&gt; <br />&lt;link rel="stylesheet" href="$stylesheet" type="text/css" /&gt; <br />&lt;link rel="shortcut icon" href="{$config['images']}/favicon.ico" /&gt; <br />$javascript <br />&lt;title&gt;{$config['title']}: $inputTitle&lt;/title&gt; <br />&lt;/head&gt; <br />&lt;body&gt; <br />&lt;!-- END OF header.tmpl TEMPLATE --&gt; <br />UBBTPRINT <br />/* UBBTREMARK */ ?&gt;



TO THIS:


Code
&lt;? //UBBTREMARK <br />header("Pragma: private"); <br />header("Expires: 0"); <br />header("Cache-Control: private, post-check=0, pre-check=0"); <br />echo &lt;&lt;&lt;UBBTPRINT <br />&lt;!-- START OF header.tmpl TEMPLATE --&gt; <br />&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <br />&lt;html dir="{$ubbt_lang['READ_DIRECTION']}"&gt; <br />&lt;head&gt; <br />$headerinsert <br />$refresh <br />&lt;meta http-equiv="Content-Type" content="text/html; charset={$ubbt_lang['CHARSET']}" /&gt; <br />&lt;link rel="stylesheet" href="$stylesheet" type="text/css" /&gt; <br />&lt;link rel="shortcut icon" href="{$config['images']}/favicon.ico" /&gt; <br />$javascript <br />&lt;title&gt;{$config['title']}: $inputTitle&lt;/title&gt; <br />&lt;/head&gt; <br />&lt;body&gt; <br />&lt;!-- END OF header.tmpl TEMPLATE --&gt; <br />UBBTPRINT <br />/* UBBTREMARK */ ?&gt;


:-)

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Sponsored Links
Re: Finished-[6.2-6.3-6.4] Allow Visited Pages To Be Cached By Browser [Re: smoknz28] #263595
06/16/2004 6:00 AM
06/16/2004 6:00 AM
Joined: Dec 2000
Posts: 1,545
Germany
A
Astaran Offline
Addict
Astaran  Offline
Addict
A
Joined: Dec 2000
Posts: 1,545
Germany
This also works for 6.5.
Can someone modify the initial post?

Re: Finished-[6.2-6.3-6.4-6.5] Allow Visited Pages To Be Cached By Browser [Re: -Fusion-] #263596
06/16/2004 9:09 AM
06/16/2004 9:09 AM
Joined: Sep 2003
Posts: 524
Twisty Offline OP
Code Monkey
Twisty  Offline OP
Code Monkey
Joined: Sep 2003
Posts: 524
Thanks for verifying. Done.

Re: Finished-[6.2-6.3-6.4-6.5] Allow Visited Pages To Be Cached By Browser [Re: smoknz28] #263597
06/16/2004 3:28 PM
06/16/2004 3:28 PM
Joined: Aug 2000
Posts: 1,802
North Carolina
D
DLWebmaestro Offline
Addict
DLWebmaestro  Offline
Addict
D
Joined: Aug 2000
Posts: 1,802
North Carolina
Is there a way to find out if your host uses an HTTP header which prevents already visited forum pages from being cached?

Re: Finished-[6.2-6.3-6.4-6.5] Allow Visited Pages To Be Cached By Browser [Re: eslmix] #263598
06/16/2004 9:15 PM
06/16/2004 9:15 PM
Joined: Sep 2003
Posts: 524
Twisty Offline OP
Code Monkey
Twisty  Offline OP
Code Monkey
Joined: Sep 2003
Posts: 524
[]DLWebmaestro said:
Is there a way to find out if your host uses an HTTP header which prevents already visited forum pages from being cached? [/]

Indeed there is. Upload this page to your ubbthreads folder (well it can go anywhere, but is most convenient there imo) and then open it in your browser.

Now notice the section where it says "Cache-Control" & "Pragma" and report back the configuration.

My server uses this (which *doesn't* cache PHP pages)...

------------------------------------------------------------
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

Pragma: no-cache
------------------------------------------------------------

But regardless of what it's already set at, it won't do any harm at all to change the threads header to whatever you want as that will supercede the server header no matter what it currently is.

Sponsored Links
Re: Finished-[6.2-6.3-6.4-6.5] Allow Visited Pages To Be Cached By Browser [Re: smoknz28] #263599
06/17/2004 4:43 PM
06/17/2004 4:43 PM
Joined: Aug 2000
Posts: 1,802
North Carolina
D
DLWebmaestro Offline
Addict
DLWebmaestro  Offline
Addict
D
Joined: Aug 2000
Posts: 1,802
North Carolina
I already had an info.php file loaded.

The only listing mentioning cache is:
[]
session.cache_expire 180 180
session.cache_limiter nocache nocache
[/]

The word "pragma" does not exist.

Re: Finished-[6.2-6.3-6.4-6.5] Allow Visited Pages To Be Cached By Browser [Re: eslmix] #263600
06/17/2004 9:53 PM
06/17/2004 9:53 PM
Joined: Sep 2003
Posts: 524
Twisty Offline OP
Code Monkey
Twisty  Offline OP
Code Monkey
Joined: Sep 2003
Posts: 524
Well an easy way to tell is by simply looking in your browser cache to see if any forum pages are found there

With yours, it is already caching them so you have nothing to worry about.

Re: Finished-[6.2-6.3-6.4-6.5] Allow Visited Pages To Be Cached By Browser [Re: smoknz28] #263601
06/23/2004 9:12 PM
06/23/2004 9:12 PM
Joined: Mar 2003
Posts: 231
Canada
R
RandyJG Offline
Junior Member
RandyJG  Offline
Junior Member
R
Joined: Mar 2003
Posts: 231
Canada
I was just wondering, when using this, and returning to a forum that's been cached, doesn't this mess up marked read display until the user refreshes the page? As well as new posts that they've added not showing up until the thread is refreshes, etc

Last edited by RandyJG; 06/23/2004 9:13 PM.
Re: Finished-[6.2-6.3-6.4-6.5] Allow Visited Pages To Be Cached By Browser [Re: romka] #263602
06/24/2004 7:40 AM
06/24/2004 7:40 AM
Joined: Sep 2003
Posts: 524
Twisty Offline OP
Code Monkey
Twisty  Offline OP
Code Monkey
Joined: Sep 2003
Posts: 524
[]RandyJG said:
I was just wondering, when using this, and returning to a forum that's been cached, doesn't this mess up marked read display until the user refreshes the page? As well as new posts that they've added not showing up until the thread is refreshes, etc [/]

I think I explained it pretty well in my initial post. All links (ie. forum navigation links) will still load pages fresh which is an important point, but the browser <- -> buttons will draw from the cache (which as you say won't be updated until refreshed). Thus the user decides which method they wish to use.

This way those on dialup can refresh occassionally as needed instead of constantly which is much slower.

Incidentally, the functionality with this enabled will be identical to the way the threadsdev forum functions right now, because it caches pages too.


Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with, and recommend, the following Web Hosts:
· Stable Host
· Blue Host
· Interserver.net
Visit Us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,170
Joined: July 2001
Show All Member Profiles 
Forum Statistics
Forums64
Topics37,448
Posts293,484
Members13,793
Most Online1,498
Mar 17th, 2017
Top Posters(All Time)
AllenAyres 25,587
JoshPet 11,330
Rick 8,373
LK 7,396
Lord Dexter 6,503
Gizmo 5,938
Greg Hard 5,533
Top Posters(30 Days)
Today's Statistics
Currently Online 743
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 15
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2018 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.6.2
(Preview build 20180622.dev)
Page Time: 0.032s Queries: 15 (0.009s) Memory: 3.2899 MB (Peak: 3.4653 MB) Zlib enabled. Server Time: 2018-07-15 21:23:14 UTC