Prevent WebHelp Caching in Browser.

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
JeffR
Posts: 7

Prevent WebHelp Caching in Browser.

Wed Apr 02, 2014 8:57 pm

Hey folks,

Is there a way to prevent browsers from caching webhelp?

I had a situation where someone requested a change to topic content and could not see the updates until they refreshed the browser. Easy fix in this instance, but I want to eliminate the possibility of my readers using stale cached content when updates are available.

Thanks!!
sorin_ristache
Posts: 4144

Re: Prevent WebHelp Caching in Browser.

Thu Apr 03, 2014 3:28 pm

Hello,

You can add meta instructions in every Webhelp page that disables the browser cache policy. It seems the following two header instructions added in a web page disables the cache policy in recent versions of all browsers:

Code: Select all

    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="-1" />


You should add these two lines:

  • in the "jsAndCSS" template from file:

    [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\xsl\dita\desktop\common.xsl

    following the line:

    Code: Select all

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

  • in the "create-toc-common-file" template from file:

    [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\xsl\createMainFiles.xsl

    following the lines:

    Code: Select all

    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>


Regards,
Sorin
kirkilj
Posts: 66

Re: Prevent WebHelp Caching in Browser.

Wed Dec 17, 2014 9:38 pm

I just ran into this myself yesterday. I posted a new version of content and authors were looking for the changes that they had made and couldn't see them. Holding down the shift-key and doing a refresh brought in the new version, so the old version was cached in the browser. I wanted to see if there was a way to do this from Apache rather than edit the transform assets, and I came upon something like the following that can be placed in the .htaccess file for the WebHelp root directory:

Code: Select all

<filesMatch "\.(html|htm|js|css)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
</filesMatch>

I like the option of specifying a pattern to match against in case different caching strategies are needed. I'll try this in a couple days. If there's some reason why this is a bad idea, I'm all ears.
sorin_ristache
Posts: 4144

Re: Prevent WebHelp Caching in Browser.

Thu Dec 18, 2014 10:36 am

If different caching strategies are needed for different directories on the web server then it surely sounds like a good idea.

The only disadvantage that I can see is a little slower access to the WebHelp pages due to the requirement to check all ancestor directories on the web server for .htaccess files.
Regards,
Sorin

<oXygen/> XML Editor Support
runleonarun
Posts: 9

Re: Prevent WebHelp Caching in Browser.

Tue Apr 18, 2017 3:26 am

Do I need to run the ant -f integrator.xml in the DITA-OT after adding this info to the files?
bogdan_cercelaru
Posts: 205

Re: Prevent WebHelp Caching in Browser.

Tue Apr 18, 2017 3:23 pm

Hello,

No, you don't need to run "ant -f integrator.xml" after adding this.

Regards,
Bogdan
Bogdan Cercelaru
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
misti
Posts: 13

Re: Prevent WebHelp Caching in Browser.

Mon May 21, 2018 4:03 pm

Any update on how to prevent caching for the Oxygen 20 webhelp responsive build?
bogdan_cercelaru
Posts: 205

Re: Prevent WebHelp Caching in Browser.

Tue May 29, 2018 2:43 pm

Hello,

Unfortunately we don't have a mechanism to invalidate the entire HTML files. This is controlled by the web server or the client browser.
More information about how browser caching works can be found here: https://developer.mozilla.org/en-US/doc ... TP/Caching

You can add the following header field in each HTML files
<meta http-equiv="Cache-control" content="no-cache" />
using the "webhelp.fragment.head" parameter. More information can be found here: https://www.oxygenxml.com/doc/versions/ ... gment_head

Regards,
Bogdan
Bogdan Cercelaru
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 2 guests